I am using the Force Directed Tree from amCharts4 as a navigation option. I have a tree with only 2 levels. When I click on the top level nodes they expand and retract as expected. If I click on the second level nodes, it should scroll down to an anchor in the same page. The id of the target anchor is part of the input data array, like:
networkSeries.data = [
{
"name":"Node 1",
"value":200,
"children": [
{ "name": "1", "label": "Children 1", value: 10, "url": "myAnchorChildren1" },
{ "name": "2", "label": "Children 2", value: 10, "url": "myAnchorChildren2" },
{ "name": "3", "label": "Children 3", value: 10, "url": "myAnchorChildren3" }
]
},
....
];
I have managed to create clickable nodes with template.url
. However, the template.url
option is applied to all levels, which means that I loose the expand and retract feature of the top nodes. I guess it can be achieved with adapters, but I could not find how.
Thank you in advance.
question from:
https://stackoverflow.com/questions/65622901/amcharts4-in-a-force-directed-tree-i-want-to-click-on-any-second-level-node-a 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…