DataViz.Layout.Sankey.Types
- Package
- purescript-hylograph-layout
- Repository
- afcondon/purescript-hylograph-layout
DataViz.Layout.Sankey.Types
Pure PureScript implementation of Sankey diagram layout types. This replaces the FFI-based approach with first-class PureScript types that integrate naturally with the phantom type system.
#LinkCSVRow Source
type LinkCSVRow = { s :: String, t :: String, v :: Number }Input format for links from CSV (user-provided flow data with named nodes)
#SankeyNodeInput Source
type SankeyNodeInput = { name :: String }Input format for nodes (minimal user-provided data) - for backward compatibility
#SankeyNode Source
type SankeyNode = { color :: String, depth :: Int, index :: NodeID, layer :: Int, name :: String, nodeHeight :: Int, sourceLinks :: Set NodeID, targetLinks :: Set NodeID, value :: Number, x0 :: Number, x1 :: Number, y0 :: Number, y1 :: Number }Internal node representation after layout computation This has all computed properties needed for rendering
#initialiseSankeyLink Source
initialiseSankeyLink :: { id :: LinkID, source :: NodeID, target :: NodeID, value :: Number } -> SankeyLink#SankeyLayoutResult Source
type SankeyLayoutResult = { cycleAnalysis :: CycleAnalysis, links :: Array SankeyLink, nodes :: Array SankeyNode }Result of Sankey layout computation
#SankeyConfig Source
type SankeyConfig = { alignment :: Alignment, extent :: { x0 :: Number, x1 :: Number, y0 :: Number, y1 :: Number }, iterations :: Int, linkColorMode :: LinkColorMode, nodePadding :: Number, nodeValueStrategy :: NodeValueStrategy, nodeWidth :: Number }Configuration for Sankey layout algorithm
#SankeyStep Source
type SankeyStep = { iteration :: Int, label :: String, links :: Array SankeyLink, nodes :: Array SankeyNode }A captured step for debugging/visualization
#LinkColorMode Source
#CycleTopology Source
data CycleTopologyClassification of cycle topology in a flow graph. Determined after layer assignment by examining back-edge endpoints.
Constructors
Instances
#CycleAnalysis Source
type CycleAnalysis = { endCycles :: Array SankeyLink, interiorCycles :: Array SankeyLink, topology :: CycleTopology }Analysis of back-edges in a flow graph, computed after layout.
#RibbonLayout Source
data RibbonLayoutClassified layout result. Each constructor carries exactly the data its rendering strategy needs. Pattern match to select the right renderer.
Constructors
AcyclicLayout { links :: Array SankeyLink, nodes :: Array SankeyNode }EndCyclicLayout { endCycles :: Array SankeyLink, links :: Array SankeyLink, nodes :: Array SankeyNode }InteriorCyclicLayout { interiorCycles :: Array SankeyLink, links :: Array SankeyLink, nodes :: Array SankeyNode }MixedCyclicLayout { endCycles :: Array SankeyLink, interiorCycles :: Array SankeyLink, links :: Array SankeyLink, nodes :: Array SankeyNode }
#classifyLayout Source
classifyLayout :: SankeyLayoutResult -> RibbonLayoutClassify a layout result into the appropriate rendering variant.
#FlowContext Source
type FlowContext = { incoming :: Array Number, outgoing :: Array Number }The flows incident on a node, separated by direction
#NodeValueStrategy Source
newtype NodeValueStrategyStrategy for computing a node's value from its incident flows. This is the primary parameterization point for generalizing beyond Sankey diagrams to arbitrary ribbon layouts.
Constructors
#sankeyNodeValue Source
sankeyNodeValue :: NodeValueStrategySankey: node value = max(sum inflows, sum outflows). The conservation-of-flow constraint that defines a Sankey diagram.
#constantNodeValue Source
constantNodeValue :: Number -> NodeValueStrategyConstant node size, ignoring flow values entirely. Useful for pure topology/routing diagrams.
#bottleneckNodeValue Source
bottleneckNodeValue :: NodeValueStrategyBottleneck: node value = min(sum inflows, sum outflows). Highlights capacity constraints — nodes are only as tall as their tightest side.
#maxNodeValue Source
maxNodeValue :: NodeValueStrategyMaximum single flow: node value = max of all incident flow values. Useful for time/latency metrics where parallel inputs don't sum — the node waits for the slowest input.
#defaultSankeyConfig Source
defaultSankeyConfig :: Number -> Number -> SankeyConfigDefault configuration matching D3 defaults
#SankeyGraphModel Source
type SankeyGraphModel = { backEdgeLinks :: Array SankeyLink, capturedSteps :: Array SankeyStep, config :: SankeyConfig, graph :: WeightedDigraph NodeID Number, linkCount :: Int, nodeCount :: Int, nodeIDToName :: NodeNameMap, nodeNameToID :: NodeIDMap, nodeOrder :: Array NodeID, sankeyLinks :: Array SankeyLink, sankeyNodes :: Array SankeyNode }Graph model for State monad - contains all intermediate computation state SankeyGraphModel is created by folding rows of CSV
- 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. 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. CSV - DataViz.
Layout. Sankey. Compute - DataViz.
Layout. Sankey. ComputeWithSteps - DataViz.
Layout. Sankey. Path - DataViz.
Layout. Sankey. Types - DataViz.
Layout. StateMachine - DataViz.
Layout. StateMachine. Layout - DataViz.
Layout. StateMachine. Path - DataViz.
Layout. StateMachine. Types