DEV Community

RashmithaK
RashmithaK

Posted on

In d3 how to calculate dynamically width and edge?

0

How to calculate the dy and width value dynamically? if the tree strcture changes every time.

code Used

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…

Top comments (1)

Collapse
 
eerk profile image
eerk

I have been looking for a solution for this too. It seems not possible to set the chart's width based on the amount of data. You have to set the width beforehand.