d3.js - D3 force layout fix root node at the center -
I managed to draw some basic D3 force layout graphs, but struggling to fix the root node in the center .
My data is rather simple; One root node with children of one level Only one level is another special thing about my graph that the link distance is different depending on some parameters.
I have to put the root node in the center of the graph.
Setting its property 'fixed': does not really work. Any idea of having a root node in the center?
force. ("Tick" function () {nodes [0] .x = w / 2; nodes [0]. Y = h / 2;
should do this.
Comments
Post a Comment