Module

DataViz.Layout.Sankey.Whole

Package
purescript-hylograph-layout
Repository
afcondon/purescript-hylograph-layout

The whole picture. The Sankey layout places the nodes that links mention and routes the links that go forward. Two things are left over: the links that close a cycle, and the nodes that no link mentions at all. computeWholeLayout places those too, under the chart, and leaves the chart itself exactly as computeLayoutWithLanes (or computeLayoutWithLanesAtScale) gives it:

  extent.y0  ┌──────────── the chart: columns, lanes ───────────┐
             └──────────────────────────────────────────────────┘
             backEdges.margin
             ══ a channel for each back-edge, in input order ════
             shelf.margin
             ▭ ▭ ▭ ▭   the shelf: the isolated nodes, in the order
             ▭ ▭       given, in rows, left to right from extent.x0

A node that only a link to itself mentions is not isolated: it stands in the chart, in the first column, as tall as that link is wide.

#Sizing Source

data Sizing

How the chart gets its size. FitExtent: it fills config.extent, as the Sankey layout always has. AtScale: config.extent gives only its top left corner, and it is as large as the scale makes it.

Constructors

#BackEdgeRouting Source

type BackEdgeRouting = { gap :: Number, margin :: Number, reach :: Number }

margin: from the bottom of the chart to the first channel. gap: between one channel and the next. reach: how far a back-edge swings out beyond a node's side as it turns (generateBackEdgePath).

#ShelfOptions Source

type ShelfOptions = { columnPitch :: Number, margin :: Number, minimumColumns :: Int, nodeHeight :: Number, rowGap :: Number }

margin: from what is above the shelf (the channels, or the chart) to its first row. A row holds as many nodes as the chart has columns, and at least minimumColumns. columnPitch: from the left of one node to the left of the next. Each node is config.nodeWidth wide and nodeHeight tall, with rowGap between rows.

#WholeOptions Source

type WholeOptions = { backEdges :: BackEdgeRouting, shelf :: ShelfOptions, sizing :: Sizing }

#IsolatedNode Source

type IsolatedNode = { column :: Int, name :: String, row :: Int, x0 :: Number, x1 :: Number, y0 :: Number, y1 :: Number }

A node that no link mentions, on the shelf.

#Extent Source

type Extent = { x0 :: Number, x1 :: Number, y0 :: Number, y1 :: Number }

#WholeLayout Source

type WholeLayout = { backEdges :: Array RoutedBackEdge, chart :: Extent, cycleAnalysis :: CycleAnalysis, extent :: Extent, isolated :: Array IsolatedNode, nodes :: Array SankeyNode, routes :: Array Route, waypoints :: Array SankeyNode }

nodes, waypoints, routes, cycleAnalysis: as in LaneLayout. backEdges: the links set aside, each with its channel, in input order. isolated: the nodes no link mentions, in the order given. chart: the box around the nodes and waypoints. extent: the box around everything, the turns of the back-edges included.

#computeWholeLayout Source

computeWholeLayout :: WholeOptions -> (Int -> LinkCSVRow -> Boolean) -> Array String -> Array LinkCSVRow -> SankeyConfig -> WholeLayout

The layout of rows, with lanes for the long links that wants chooses, and with a place for every back-edge and for every name in names that no row mentions. names may be all of the caller's nodes or only the ones that may be isolated; with none, and with FitExtent, the nodes, waypoints and routes are computeLayoutWithLanes's.

#isolatedAmong Source

isolatedAmong :: Array String -> Array LinkCSVRow -> Array String

The names among names that no row mentions, each once, in order.