Closed jakub-zawislak closed 4 years ago
That's a really nice idea! Could you post a quick codesandbox to see what kind of result it gives?
I also tried to trigger the layout calculating after the first render of chart to get the sizes of nodes from DOM. Unfortunately, this approach didn't work if some nodes are not visible on screen, because they are not rendered in DOM. Eventually, I decided that I don't need nodes with variable dimensions in my project.
SmartRouting doesn't seem to do what's requested by the OP though. The example you linked to still have to set their position manually
It would be nice to have an automatic layout feature.
Here is my example using dagre:
Chart data
Initialize dagre
Calculate layout:
Save it to the chart variable:
Downside of calculating it before rendering is that we may don't know sizes of nodes.