Hylograph.Flow.Render.Internal.Bands
- Package
- purescript-hylograph-flow-render
- Repository
- afcondon/purescript-hylograph-flow-render
Room made down the page: for nodes taller than their edges make them, and for the outlines of open groups.
The Sankey layout gives every box (a node, or the waypoint of a long edge) a column and a place down it, with one gap between any two boxes of a column. It has no way to be told that this box needs to be taller, or that these boxes are to stand in a frame that nothing else enters. This module moves boxes down, and only down, until both hold.
What it is given is a forest of blocks in the order they are to stand
in, top to bottom: a block is one box, or a cluster of blocks (an open
group). A block's extent is the columns it spans, first to last, and
its top and bottom; a cluster's is the extent of what is in it, with
padding all round and header more above. The blocks of one level
are taken in order, and each is moved down, rigidly, by the least that
puts its top gap under the bottom of every earlier block of its level
in every column of its extent, whether or not it has a box in that
column. So the extents of the blocks of a level are disjoint
rectangles (in columns by top and bottom), which is what makes an
outline hold its members and nothing else.
That works only when the order given agrees, in every column, with the
order the boxes already stand in (a block never moves up past another).
The caller sees to that: it holds the Sankey layout to the same order
with nodeSort.
A box with no place yet (top: Nothing: a member of an open group that
no edge touches, which the Sankey layout would put on a shelf far from
its group) is stood under what its level already has in its column.
#Frame Source
type Frame = { bottom :: Number, depth :: Int, firstLayer :: Int, group :: GroupId, lastLayer :: Int, leaves :: Array String, levels :: Int, parent :: Maybe GroupId, top :: Number }A cluster as placed. depth: how many clusters it is inside.
levels: how many levels of cluster are inside it. leaves: every box
in it, however deep.