Hylograph.Components.Binning
- Package
- purescript-hylograph-components
- Repository
- afcondon/purescript-hylograph-components
Histogram binning preprocessor.
Pure functions over Array Number producing Array Bin. There is no
Histogram chart module by design: a histogram is a BarChart whose
categories are bin ranges and whose barPadding is set to 0 so the
bars touch. That makes this module the entire taxonomy cost of adding
"histogram" to the library.
equalWidth — fixed-width bins over [min, max]. Classic histogram.
equalCount — quantile bins: each bin holds roughly the same number of
samples. Widths vary; useful for skewed data.
Values exactly equal to the upper bound of the dataset are assigned to the final bin (half-open [lo, hi) in the interior, closed on the right end — D3's behaviour).
#equalCount Source
equalCount :: Int -> Array Number -> Array Binn quantile bins: each bin holds roughly length values / n samples,
so widths reflect the distribution's shape. Ties are resolved in sort
order (same sample may shift by one bin depending on sort stability —
matches D3's d3.bin().thresholds for quantile thresholds).
#defaultLabel Source
defaultLabel :: Bin -> StringDefault bin label: "start–end" with one decimal place. Many callers
want a custom format (integers, units, currency); bypass this and
build the label per bin directly on the chart's encoding.category.
- 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