Module

Hylograph.Components.BoxPlot

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

Box plot component.

Shows the distribution of value within each category: a box spanning q1 to q3 with a median line; whiskers extending to the farthest non-outlier value within whiskerIQRMultiplier × IQR of the quartiles; outliers rendered as separate dots.

Multi-series is analogous to BarChart with Grouped stacking — each (category, series) pair gets its own sub-box within the category's allocated band, coloured from theme.categoricalPalette.

Quartiles are computed via linear interpolation (the usual "type 7" percentile) on the sorted values within each (category, series) group.

Key / tooltip channels: unlike per-row marks, a box aggregates many rows. The Encoding still carries key and tooltip for API consistency with the rest of the library, but the box itself uses a synthesized key of the form <category>·<series> and a synthesized tooltip built from the computed statistics (n, q1, median, q3, whiskers, outlier count). The per-row key/tooltip projections are currently unused; they are held in reserve for future outlier-level interaction.

#Orientation Source

data Orientation

Box orientation. Vertical = categories along X, values up Y (default). Only Vertical is honoured in v1; Horizontal is declared so downstream Config-editing tools (Atelier) can offer it as a toggle, but the render path currently ignores it.

Constructors

#Encoding Source

type Encoding :: Row Type -> Typetype Encoding r = { category :: Record r -> String, key :: Record r -> String, series :: Record r -> String, tooltip :: Record r -> String, value :: Record r -> Number }

#AxisLabels Source

type AxisLabels = { x :: Maybe String, y :: Maybe String }

#Config Source

type Config :: Row Type -> Typetype Config r = { boxFraction :: Number, encoding :: Encoding r, highlightGroup :: Maybe String, labels :: AxisLabels, layout :: Layout, orientation :: Orientation, outlierRadius :: Number, whiskerIQRMultiplier :: Number }

#Input Source

type Input :: (Type -> Type) -> Row Type -> Typetype Input t r = { config :: Config r, dataset :: t (Record r), theme :: Theme }

#config Source

config :: forall r. { category :: Record r -> String, value :: Record r -> Number } -> Config r

Smart-constructor with reasonable defaults.

Caller provides the two essential projections (category, value). series defaults to \_ -> ""; key defaults to category; tooltip defaults to "<category>: <value>". Note these per-row projections are unused for the box itself (see module-level note); they are defaulted for API consistency.

#boxPlot Source

boxPlot :: forall t r. Foldable t => Input t r -> Tree

Build a HATS Tree for this box plot. Pure; rendering is the caller's concern (see frame).

#frame Source

frame :: forall query output t r m. MonadAff m => Foldable t => Component query (FrameInput (Input t r)) output m

Halogen component wrapping boxPlot. One-line mkFrame delegation.