Friday, October 12, 2018

Add event listener per nodes level on d3 chart

Leave a Comment

I am still on my chart, and I need to default close the level 2 & 3 nodes, and keep the expand/collapse function on click.

Depending on the node clicked and its level, run a specific action (change color for example). My link must be a value of my data object (var pubs in my codepen) as you can see bellow (level 0 has no link, "TOOLS" in my example) :

{     "name": "TOOLS",     "children":        [         {             "name": "Localization",             "url": "http://#",             "children":                              [                    {"name": "FRANCE", "url": "http://france.fr"} ... 

Finaly another event listener on "mouseover" to do some styling on the node (closed or open) etc...

My current code : https://codepen.io/anon/pen/BqjJJv

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment