Convert an am5hierarchy.ForceDirected series into NetworkPoint
links.
The awkward one. A force-directed graph is a hierarchy series in
amCharts, not a link list: its data is a tree of children, and the links a
reader sees are the parent-child edges of that tree plus whatever cross-links
each row named. So the same walk the treemap uses supplies the tree — each
node's parent is the last name on its path — and the cross-links are read
off the authors' own rows afterwards.
Nothing about the layout is read. Where the solver dropped a node is a fact
about its seed rather than about the data, which is why NetworkPoint has
nowhere to put one.
A cross-link naming something the walk never saw is skipped rather than
turned into a node: amCharts draws no link for it either, and inventing the
node would announce a participant the chart does not have. Each pair is
emitted once — a link is undirected, and two rows naming each other draw one
line.
The tree is read as amCharts draws it, which the series' topDepth decides
(Hierarchy, LinkedHierarchy, LinkedHierarchyNode, 5.21.4). amCharts
draws a parent's links to its children only from that depth down, and once
a node is selected, as series.set("selectedDataItem", series.dataItems[0])
selects the root, it hides every node above that depth, and with it every
cross-link that reaches one. Those nodes and lines are not read.
topDepth defaults to 0, so the root of the data is a node like any other,
drawn and linked to each of its children — on amcharts-flow.html, Computing
with its three lines. The walk extractHierarchyNodes shares with the
treemap drops a single root, as a treemap draws it as the container; here
it is put back unless topDepth hides it.
Until a node is selected amCharts still draws the nodes above topDepth,
unlinked from their children, and their cross-links. Those cross-links are
not read either: the nodes are read as topDepth says, hidden.
Convert an
am5hierarchy.ForceDirectedseries into NetworkPoint links.The awkward one. A force-directed graph is a hierarchy series in amCharts, not a link list: its data is a tree of
children, and the links a reader sees are the parent-child edges of that tree plus whatever cross-links each row named. So the same walk the treemap uses supplies the tree — each node's parent is the last name on its path — and the cross-links are read off the authors' own rows afterwards.Nothing about the layout is read. Where the solver dropped a node is a fact about its seed rather than about the data, which is why
NetworkPointhas nowhere to put one.A cross-link naming something the walk never saw is skipped rather than turned into a node: amCharts draws no link for it either, and inventing the node would announce a participant the chart does not have. Each pair is emitted once — a link is undirected, and two rows naming each other draw one line.
The tree is read as amCharts draws it, which the series'
topDepthdecides (Hierarchy,LinkedHierarchy,LinkedHierarchyNode, 5.21.4). amCharts draws a parent's links to its children only from that depth down, and once a node is selected, asseries.set("selectedDataItem", series.dataItems[0])selects the root, it hides every node above that depth, and with it every cross-link that reaches one. Those nodes and lines are not read.topDepthdefaults to 0, so the root of the data is a node like any other, drawn and linked to each of its children — on amcharts-flow.html, Computing with its three lines. The walk extractHierarchyNodes shares with the treemap drops a single root, as a treemap draws it as the container; here it is put back unlesstopDepthhides it.Until a node is selected amCharts still draws the nodes above
topDepth, unlinked from their children, and their cross-links. Those cross-links are not read either: the nodes are read astopDepthsays, hidden.