purescript-hylograph-layout
Pure PureScript implementations of layout algorithms for hierarchies and flow diagrams.
Overview
Layout algorithms for hierarchical and graph data, implemented in
pure PureScript. Many of these layouts are familiar to users of D3 but
here they are implemented without FFI dependencies using FP
implementations in 100% PureScript. The hierarchical ones work with the
rose-tree data structure from purescript-tree-rose.
Installation
spago install hylograph-layoutAvailable Layouts
Hierarchical Layouts
- Tree - Tidy tree layout (Reingold-Tilford algorithm)
- Pack - Circle packing for hierarchical data
- Partition - Sunburst/icicle partition layout
- Treemap - Multiple tiling algorithms: squarify (default), slice, dice, sliceDice, binary
- Cluster - Dendrogram layout
Graph Layouts
- Sankey - Flow diagram layout for directed acyclic
graphs (uses
hylograph-graphfor DAG operations) - EdgeBundle - Hierarchical edge bundling
- Chord - Chord diagram layout
- Adjacency - Adjacency matrix layout
Example
import DataViz.Layout.Hierarchy.Tree (tree, defaultTreeConfig)
import Data.Tree (mkTree)
myTree = mkTree "root" [mkTree "a" [], mkTree "b" []]
config = defaultTreeConfig { size = { width: 400.0, height: 300.0 } }
positioned = tree config myTree
-- Each node now has x, y coordinatesModules
DataViz.Layout.Hierarchy.Tree- Tree layoutDataViz.Layout.Hierarchy.Pack- Circle packingDataViz.Layout.Hierarchy.Partition- Partition/sunburstDataViz.Layout.Hierarchy.Treemap- TreemapDataViz.Layout.Hierarchy.Cluster- DendrogramDataViz.Layout.Hierarchy.EdgeBundle- Edge bundlingDataViz.Layout.Sankey.Compute- Sankey diagramsDataViz.Layout.Chord- Chord diagramsDataViz.Layout.Adjacency- Adjacency matrix
Part of Hylograph
- hylograph-layout - Layout algorithms (this package)
- hylograph-graph - Graph algorithms and DAG support
- hylograph-selection - D3 selection library
- hylograph-simulation - Force simulation
Uses tree-rose for rose tree data structures.
License
MIT
