iamjagjeetSeptember 11, 2017 at 5:53 pm #8047
Great job in putting up weighted tree.My users are delighted to use this tree.Can you please let me know how can we add additional controls in the node of weighted tree.Right now the node has circle and text.We want to add a button to the node and also want to associate an event with the button.
I tried to add a button in vizuly_weightedtree.min.js once text is appended to the circle control.I can see the button in the browser code but the button is not visible in the tree node.
ThanksvizulySeptember 12, 2017 at 9:18 am #8048
You will want to use the source code files to start your modifications (versus the minified files)
The tree is being rendered in SVG, which draws primitive graphics (rectangles, circles, paths, etc) but SVG does not support widgets like buttons. You could simulate a button by drawing a rectangle, and adding border treatments etc that then responds to user input (clicking, mouse-over etc.) but that is beyond the scope of what would be easy to explain via a forum.
The place you would want to add this coded is in the viz/weighted_tree.js file in the “update()” function which is responsible for adding/updating/removing the tree nodes and branches.
Alternatively, the tree currently emits an event when a user clicks on a node, and it is simple enough to trap this event and respond to it accordingly. This would alleviate the need to add a button to each node.
I hope that helps,
Additional controls in the node of weighted tree
© 2018 — vizuly.io