DataViz.Layout.Sankey.Lanes
- Package
- purescript-hylograph-layout
- Repository
- afcondon/purescript-hylograph-layout
Lanes for long links. A link that spans more than one column is, in plain Sankey layout, drawn straight across the columns between, through whatever nodes stand there. The standard remedy (Sugiyama's dummy nodes) is to give such a link a waypoint in every column it passes: the layout then keeps room for it in each, as for any node, and the link is drawn as one ribbon through its waypoints.
computeLayoutWithLanes does this for the links the caller chooses. It
lays the graph out once to learn each node's column, adds the waypoints,
and lays it out again with every column held, so the chart keeps the
columns it would have had. Back-edges get no lane; they are returned in
backEdges, by the caller's names, with where each stands on its nodes
(see DataViz.Layout.Sankey.BackEdge for drawing them).
computeLayoutWithLanesAtScale is the same layout at a scale the caller
fixes, where config.extent would otherwise fit it to a box.
A waypoint's name is private (laneOf reads it). A caller with its own
nodeSort sees waypoints in the comparisons and can place a lane, for
example with the node its link comes from: laneOf says which link and
which column.
Built for Triggerfish's signal-flow chart (2026-10-04), where a machine upstream of another sends notes through that machine's column.
#Route Source
type Route = { index :: Int, segments :: Array SankeyLink }One input link, as drawn: its segments in order, from its source through
its waypoints (if any) to its target. index is its place in the input.
#LaneLayout Source
type LaneLayout = { backEdges :: Array BackEdge, cycleAnalysis :: CycleAnalysis, nodes :: Array SankeyNode, routes :: Array Route, waypoints :: Array SankeyNode }nodes: the graph's own nodes, without waypoints. waypoints: the lane
nodes, for drawing routes (pass nodes <> waypoints to
generateRoutePath). routes: one per input link, in input order; a
back-edge's route has no segments. backEdges: the links set aside, in
input order, index being the link's place in the input and source
and target its row's names.
#computeLayoutWithLanes Source
computeLayoutWithLanes :: (Int -> LinkCSVRow -> Boolean) -> Array LinkCSVRow -> SankeyConfig -> LaneLayoutThe layout, with a lane for every input link that spans more than one
column and that wants (given its input index and row).
#computeLayoutWithLanesAtScale Source
computeLayoutWithLanesAtScale :: Scale -> (Int -> LinkCSVRow -> Boolean) -> Array LinkCSVRow -> SankeyConfig -> LaneLayoutThe same, at a scale the caller fixes: config.extent gives only the
top left corner, and the chart is as wide and as tall as the scale makes
it (see configAtScale).
#generateRoutePath Source
generateRoutePath :: Array SankeyNode -> Route -> StringA route as one closed ribbon: the top edge forward through each segment
and across each waypoint, the bottom edge back. nodes must include the
waypoints.
- Modules
- DataViz.
Layout. Adjacency - DataViz.
Layout. Adjacency. Layout - DataViz.
Layout. Adjacency. Types - DataViz.
Layout. BlockCutTree - DataViz.
Layout. Chord - DataViz.
Layout. Chord. Layout - DataViz.
Layout. Chord. Types - DataViz.
Layout. Hierarchy. Cluster - DataViz.
Layout. Hierarchy. Core - DataViz.
Layout. Hierarchy. EdgeBundle - DataViz.
Layout. Hierarchy. EdgeBundle. Bilink - DataViz.
Layout. Hierarchy. EdgeBundle. BundleCurve - DataViz.
Layout. Hierarchy. EdgeBundle. Hierarchy - DataViz.
Layout. Hierarchy. EdgeBundle. RadialCluster - DataViz.
Layout. Hierarchy. EdgeBundle. Types - DataViz.
Layout. Hierarchy. Link - DataViz.
Layout. Hierarchy. Pack - DataViz.
Layout. Hierarchy. Partition - DataViz.
Layout. Hierarchy. Placed - DataViz.
Layout. Hierarchy. Tree - DataViz.
Layout. Hierarchy. TreeStyle - DataViz.
Layout. Hierarchy. Treemap - DataViz.
Layout. Hierarchy. Types - DataViz.
Layout. Pattern - DataViz.
Layout. Pattern. Adapters - DataViz.
Layout. Pattern. Types - DataViz.
Layout. Sankey. BackEdge - DataViz.
Layout. Sankey. CSV - DataViz.
Layout. Sankey. Compute - DataViz.
Layout. Sankey. ComputeWithSteps - DataViz.
Layout. Sankey. Lanes - DataViz.
Layout. Sankey. Path - DataViz.
Layout. Sankey. Types - DataViz.
Layout. Sankey. Whole - DataViz.
Layout. StateMachine - DataViz.
Layout. StateMachine. Layout - DataViz.
Layout. StateMachine. Path - DataViz.
Layout. StateMachine. Tree - DataViz.
Layout. StateMachine. Types - DataViz.
Layout. TidyDag