Module

Hylograph.Components.LinePlot

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

Line plot component.

Single series: the input rows are visited in iteration order, connected by a straight-segment Path. For multi-series, compose multiple LinePlot instances in the same container (different Frames) or wait for a dedicated MultiLine preset.

Rows aren't sorted internally — the user's dataset order is the line's order. Sort before passing in if that matters.

Encoding: x, y (Number), key, tooltip (String). showPoints in the Config decides whether dots are drawn on top of the line; coordinated hover is attached to the points, not the line itself.

#Encoding Source

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

#AxisLabels Source

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

#AreaFill Source

type AreaFill = { baseline :: Number, opacity :: Number }

Fill a closed region under each line down to baseline (in data space). Nothing on Config.areaFill = a plain line chart. Just _ = an area chart. The fill colour is always the line's own colour (the series colour, or theme.markFill for single-series) — opacity controls intensity. There is no separate AreaChart module by design.

#Config Source

type Config :: Row Type -> Typetype Config r = { annotations :: Array Annotation, areaFill :: Maybe AreaFill, encoding :: Encoding r, highlightGroup :: Maybe String, labels :: AxisLabels, layout :: Layout, lineWidth :: Number, pointRadius :: Number, showPoints :: Boolean, xDomain :: Maybe { max :: Number, min :: Number }, yDomain :: Maybe { max :: Number, min :: 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. { x :: Record r -> Number, y :: Record r -> Number } -> Config r

Smart-constructor with defaults. key defaults to stringified x; tooltip defaults to "(x, y)". Points are shown (radius 3) on top of the line by default.

#linePlot Source

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

#frame Source

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