I am currently using d3 to create a visual representation of data from a json file. This particular json file includes parent and children nodes structured like this:
{
"name": "root",
"size": 100,
"child": [
{
"name": "First1",
"size": 70,
"child": [
{
"name": "Second1",
"size": 85
},
{
"name": "Second2",
"size": 81
}
]
},
{
"name": "First2",
"size": 40,
"child": [
{
"name": "Second3",
"size": 50,
"child": [
{
"name": "Third1",
"size": 80
}
]
}
]
}
]
}
My intention is to visualize the size values at different depths in the data structure. For example, at depth 3, I aim to retrieve the size value of Third1; at depth 2, I need the sum of size values of Second1, Second2, and Second3; and at depth 1, I want to obtain the combined value of First1 and First2. Unfortunately, my current implementation sums up the values of lower depths instead of providing the individual node values. This has led to confusion and after spending two days on it, I have made no progress. Your assistance in resolving this issue would be greatly appreciated. Thank you!