DataViz.Layout.Hierarchy.Placed
- Package
- purescript-hylograph-layout
- Repository
- afcondon/purescript-hylograph-layout
DataViz.Layout.Hierarchy.Placed
The five hierarchy layouts behind one door: describe the hierarchy once,
and get, from any of the layouts, a Map from each node's key to where
that layout put it.
Each layout module has its own input type (a Data.Tree of records for
Tree and Cluster, Pack.HierarchyData, Partition.HierarchyData, a
ValuedNode for Treemap) and its own output tree. That is right for a
caller that draws one layout. A caller that wants several layouts of the
same data, to compare them or to move between them, would otherwise write
a converter in and a flattener out for each.
flare :: Hierarchy Node String
flare = { root, children: _.children, value: _.size, key: _.path }
packed = Placed.pack (Pack.defaultPackConfig { size = size }) flare
squared = Placed.treemap (Treemap.defaultTreemapConfig { size = size }) flare
-- Map.lookup "flare.vis.Legend" packed :: Maybe Placement
Nothing is computed differently: each function calls the layout module's own function with the configuration given, and reads the result off.
#Hierarchy Source
type Hierarchy node key = { children :: node -> Array node, key :: node -> key, root :: node, value :: node -> Number }A hierarchy, described by how to walk it. children is empty for a leaf.
value is asked of leaves only (an internal node's value is the sum of
its leaves'); a hierarchy with no natural sizes can say const 1.0.
key must be different for every node.
#Placement Source
type Placement = { depth :: Int, extent :: Extent, height :: Int, leaf :: Boolean, value :: Number, x :: Number, y :: Number }Where a layout put a node. (x, y) is the node's point for Tree and
Cluster, the centre of its circle for Pack, and the centre of its
rectangle for Treemap and Partition. depth counts from the root (0),
height from the deepest leaf below (0 for a leaf), and value is the
sum of the values of the leaves at or below the node. These three are
the same in every layout of the same hierarchy.
#Node Source
newtype Node keyThe hierarchy as every layout here is given it: keys, with what is true of a node whatever the layout.
- 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. CSV - DataViz.
Layout. Sankey. Compute - DataViz.
Layout. Sankey. ComputeWithSteps - DataViz.
Layout. Sankey. Lanes - DataViz.
Layout. Sankey. Path - DataViz.
Layout. Sankey. Types - DataViz.
Layout. StateMachine - DataViz.
Layout. StateMachine. Layout - DataViz.
Layout. StateMachine. Path - DataViz.
Layout. StateMachine. Tree - DataViz.
Layout. StateMachine. Types - DataViz.
Layout. TidyDag