Module

DataViz.Layout.Hierarchy.Treemap

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

DataViz.Layout.Hierarchy.Treemap

Pure PureScript implementation of D3's treemap layout. Partitions rectangles to represent hierarchical data with area proportional to value.

#TreemapNode Source

data TreemapNode a

Node with treemap layout coordinates Extends ValuedNode with x0, y0, x1, y1 bounds

Constructors

Instances

#TileFunction Source

type TileFunction a = TreemapNode a -> Number -> Number -> Number -> Number -> TreemapNode a

Tiling function type Takes parent node and bounds, positions children

#TreemapConfig Source

type TreemapConfig a = { paddingBottom :: Number, paddingInner :: Number, paddingLeft :: Number, paddingOuter :: Number, paddingRight :: Number, paddingTop :: Number, round :: Boolean, size :: { height :: Number, width :: Number }, tile :: TileFunction a }

Treemap configuration

#phi Source

phi :: Number

Golden ratio for squarify

#defaultTreemapConfig Source

defaultTreemapConfig :: forall a. TreemapConfig a

Default treemap configuration

#toTreemapNode Source

toTreemapNode :: forall a. ValuedNode a -> TreemapNode a

Convert ValuedNode to TreemapNode (without positioning)

#treemap Source

treemap :: forall a. TreemapConfig a -> ValuedNode a -> TreemapNode a

Main treemap layout function

#dice Source

dice :: forall a. TreemapNode a -> Number -> Number -> Number -> Number -> TreemapNode a

Dice tiling: horizontal partitioning (varies x, constant y)

#slice Source

slice :: forall a. TreemapNode a -> Number -> Number -> Number -> Number -> TreemapNode a

Slice tiling: vertical partitioning (constant x, varies y)

#sliceDice Source

sliceDice :: forall a. TileFunction a

Slice-dice tiling: alternates between slice and dice at each depth level Provides a simple alternating pattern

#binary Source

binary :: forall a. TileFunction a

Binary tiling: divides space based on splitting the value sum Simpler approach: split children into two groups, position each group with slice/dice

#squarify Source

squarify :: forall a. Number -> TileFunction a

Squarify tiling: minimizes aspect ratios (creates more square-like rectangles)