I am using D3v5 and React.
I have this data
{
"name": "main",
"children": [
{
"name": "testedin",
"children": [
{
"name":"positive",
"value": 53,
"floor":2
},
{
"name":"negative",
"value": 24,
"floor":2
},
{
"name":"unknown",
"value": 23,
"floor":2
}
],
"floor":1,
"value":55
},
{
"name": "Not tested",
"value": 45,
"floor":1
}
],
"floor":0
}
And I want to draw this chart, where the data for the second column of rects is the percentage value of the rect parent from the first column.
I have follow this example: icecle Chart and everything works fine with it.
The Problem is that with that chart al values are just sum up due to this segment of code:
const partition = data => {
const root = d3.hierarchy(data)
.sum(d => d.value)
.sort((a, b) => b.height - a.height || b.value - a.value);
return d3.partition()
.size([height, (root.height + 1) * width / 4])
(root);
}
where the .sum function just adds the values of each children.
Having this result:

I tried to alter the sum function so I can have different usage of values, but cant find a way to edit it so I can have the percentages.
