How to calculate the dy and width value dynamically? if the tree strcture changes every time.
below width will suit for the provided Json for a demo purpose. dy = 154.66666666666666 width = 928
but if the json dynamically? and the same code doesnt work for below json JSON:
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{
"name": "AgglomerativeCluster",
"children": [
{
"name": 1,
"children": [
{
"name": 2,
"children": [
{
"name": 3,
"children": [
{
"name": 4,
"children": [
{
"name": 5,
"children": [
{
"name": 6,
"value": 6
}
],
"value": 5
}
],
"value": 4
}
],
"value": 3
}
],
"value": 2
}
],
"value": 1
}
],
"value": 3938
}
]
}
]
}
]
}
need a help to calculate width and dy dynamically..