amcharts display children of a node in a table after nodeclick

I am following the guide in amcharts force-directed-network. However, the data set I have has a depth of n (a reduced sample of the json file is included below).

In addition to expanding the elements of the "bubble" at depth n, I want to create an on click event when clicking on an element at n-1 depth. The event would show a table above or below the graph showing the elements of the n-1 "bubble" that was clicked on.

In the case of the data bellow, if I click on A then I would see a table with 12 and 2. If I click on B then, 1 and 10 would appear in the table.

[{"name": "Core", "children": 
    [{"name": "CHILD", "children": 
        [{"name": "A", "children": 
            [{"name": "12", "value": 1}, 
             {"name": "2", "value": 1}]}, 
         {"name": "C", "children": 
            [{"name": "9", "value": 1}, 
             {"name": "11", "value": 1}, 
             {"name": "3", "value": 1}, 
             {"name": "6", "value": 1}]}, 
         {"name": "B", "children": 
             [{"name": "1", "value": 1}, 
              {"name": "10", "value": 1}]}, 
         {"name": "E", "children": 
             [{"name": "13", "value": 1}, 
              {"name": "5", "value": 1}]}, 
         {"name": "D", "children": 
             [{"name": "4", "value": 1}]}, 
         {"name": "F", "children": 
             [{"name": "8", "value": 1}, 
              {"name": "7", "value": 1}]}]}]}

enter image description here

18 thoughts on “amcharts display children of a node in a table after nodeclick”

Leave a Comment