Hylograph.Components.Treemap
- Package
- purescript-hylograph-components
- Repository
- afcondon/purescript-hylograph-components
Treemap component.
Packs rectangular cells into the chart's inner area, each cell sized
proportionally to a numeric value. One row per cell — flat data only
in v1; hierarchy is a future concern.
Uses the squarify algorithm (Bruls, Huijsen, van Wijk 2000), which
greedily adds cells to alternating rows/columns, picking the axis that
keeps the aspect ratio closest to 1. D3's default. Implemented inline
here rather than in Hylograph.Shape so this component ships without
a workspace retarget of hylograph-selection (see report at PR time);
promoting squarify upstream is a clean follow-up once there's a
second consumer.
series drives colour in the multi-series case (palette lookup by
distinct series name). Single-series (the default) cycles the palette
by cell index so individual cells are distinguishable without
requiring the caller to supply a fake series projection.
Labels are centred in cells whose area meets labelMinArea; smaller
cells rely on the tooltip alone to avoid text overflow.
#config Source
config :: forall r. { label :: Record r -> String, value :: Record r -> Number } -> Config rSmart-constructor with reasonable defaults.
Caller provides the two essential projections (value, label). key
defaults to label; tooltip to "<label>: <value>"; series to
\_ -> "" so the default is a single-series treemap where each cell
gets its own palette colour by index.
- Modules
- Hylograph.
Components. Annotation - Hylograph.
Components. Axis - Hylograph.
Components. BarChart - Hylograph.
Components. Binning - Hylograph.
Components. BoxPlot - Hylograph.
Components. Frame - Hylograph.
Components. Heatmap - Hylograph.
Components. Layout - Hylograph.
Components. Legend - Hylograph.
Components. LinePlot - Hylograph.
Components. LineStyle - Hylograph.
Components. Mark - Hylograph.
Components. PieChart - Hylograph.
Components. ScatterPlot - Hylograph.
Components. Series - Hylograph.
Components. Theme - Hylograph.
Components. Treemap