Module

Hylograph.Components.Series

Package
purescript-hylograph-components
Repository
afcondon/purescript-hylograph-components

Multi-series machinery shared across chart presets.

Every chart's Encoding r carries series :: Record r -> String. When all rows project to the same series name (typically "" from the default smart-constructor), charts render as a single monochrome series. When rows project to multiple distinct names, each series gets a colour from Theme.categoricalPalette and charts handle the multi-series layout in a chart-specific way (one line per series, points coloured per series, stacked/grouped bars, etc.).

This module is the one source of truth for "how do rows partition by series and in what order."

#distinctSeries Source

distinctSeries :: forall t r. Foldable t => (Record r -> String) -> t (Record r) -> Array String

Distinct series names in encounter order (first appearance wins).

#groupBySeries Source

groupBySeries :: forall t r. Foldable t => (Record r -> String) -> t (Record r) -> Array { name :: String, rows :: Array (Record r) }

Group rows by series, preserving within-series order and series encounter order in the outer array.

#seriesColor Source

seriesColor :: Array String -> String -> Int -> String

Look up a colour for a series index, cycling the palette. Falls back to the caller-supplied fallback when the palette is empty.