Hylograph.Components.BarChart
- Package
- purescript-hylograph-components
- Repository
- afcondon/purescript-hylograph-components
Bar chart component.
Surface style: one preset per Excel-class chart type. Users get a named
component (BarChart) with a typed Config record they can edit
field-by-field in Atelier or pass as a literal in code. Underneath the
preset we reach for the grammar-of-graphics primitives HATS already
provides.
Data is Foldable t => t (Record r) — Arrays, Lists, Sets, Maps (by
value), all accepted. Encoding projections pull category + value + key +
tooltip text out of each row; the defaults use category :: String and
value :: Number, override when your row shape differs.
Coordinated hover is built in: each bar registers with HATS'
onCoordinatedHighlightWithTooltip under a shared group. Two bar
charts sharing a group on the same page will highlight together for
matching keys.
#Orientation Source
#StackMode Source
data StackModeHow multiple rows sharing a category are arranged when there is more than one series.
Grouped: bars side-by-side within each category's band.Stacked: bars stacked on the value axis; axis shows raw totals.Normalized100: bars stacked and each category normalized to 100%; value axis shows percentages. Assumes one row per (category, series).
Single-series charts render identically under any mode.
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 }
Projections pulling each channel out of a row. series :: \_ -> "" in
the default smart-constructor makes single-series usage a degenerate
special case of the multi-series code path.
#config Source
config :: forall r. { category :: Record r -> String, value :: Record r -> Number } -> Config rSmart-constructor for a Config with reasonable defaults.
Pass the two projections that can't be inferred (category, value). key
defaults to category; tooltip defaults to "<category>: <value>".
Everything layout/style-wise has a starter value you can mutate.
- 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