-
vizulyDecember 21, 2016 at 11:27 am #6832
Hi Jerry,
This question had been nagging me, so I dug into the code a little bit because I recall D3 having native support for this function. Here is the solution.
Add this code to the end of the
measure()
function in viz/weightedtree.js. This will sort the nodes by the current value in ascending order. You can modify to the sort to meet your particular needs.tree.sort(function (a,b) { if (scope.value(a) > scope.value(b)) { return 1 } else if (scope.value(a) < scope.value(b)) { return -1 } else return 0; })
– Tom
You must be logged in to reply to this topic.
© 2024 — vizuly.io