Frequency distribution histogram — pure SVG, zero JS.
Accepts a flat list of numbers and bins them into bins equal-width
buckets. Bars animate in on entrance.
Examples
<.histogram_chart data={[2, 5, 7, 3, 9, 1, 4, 8, 6, 3, 5, 7, 2, 6]} />
<.histogram_chart
data={Enum.map(1..200, fn _ -> :rand.uniform(100) end)}
bins={15}
color="oklch(0.70 0.18 145)"
/>
Summary
Functions
Attributes
data(:list) (required) - Flat list of numeric values.bins(:integer) - Number of histogram bins. Defaults to10.color(:string) - Bar fill color. Defaults tonil.show_grid(:boolean) - Defaults totrue.show_labels(:boolean) - Defaults totrue.animate(:boolean) - Defaults totrue.animation_duration(:integer) - Defaults to600.theme(:map) - Chart theme overrides. Defaults to%{}.id(:string) - Unique ID for the chart (auto-generated if not provided). Defaults tonil.title(:string) - Chart title rendered above the visualization. Defaults tonil.description(:string) - Chart description for context (rendered below title). Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.