<!-- sort orders the categories by their total; when values change the bars
slide to their new places. Table, Tab order and (barSelect) keep the input order. --><sv-bar-chart-pro[categories]="regions"[datasets]="datasets()" sort="descending" />
Horizontal with title
example.htmlAngular
6 lines
1
2
3
4
5
6
<sv-bar-chart[categories]="months"[datasets]="revenue"
orientation="horizontal"
title="Revenue by month"[height]="320" />
Comparing a value across discrete categories (revenue by month, sales by region).
You want grouped or stacked series for category comparisons.
For trends over a continuous axis, use the Line Chart.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels displayed on the axis.
datasets
BarChartDataset[]
[]
One or more data series.
valuePolicy
SvValuePolicy
'clamp'
What to do with a bar this chart cannot draw — a negative value, `NaN`, `Infinity`. This is a zero-based bar chart: height is `(value / axisMax) * plotSize`, and an SVG rect refuses a negative height outright, so such a bar does not look wrong, it is simply absent. - `clamp` (default) — draw it at the baseline, mark it there, and disclose its real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a bar's position is its index within its group, so dropping one value would shift every later bar of that series out from under its own category label. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
orientation
BarChartOrientation
'vertical'
Chart orientation.
title
string
''
Chart title.
height
number
320
Chart height in px.
options
BarChartOptions
{}
Rendering and feature options.
customClass
string
''
Additional CSS classes on the root element.
ariaLabel
string
''
Accessible-name override for the chart image. When empty, a concise data summary is generated automatically; the full data is always exposed to assistive tech via a visually-hidden table.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
barSelect
{ category: string; series: string; value: number }
Emitted when a bar is clicked — for drill-down or selection.
<sv-bar-chart-pro>
Also in this family — SvBarChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels displayed on the axis.
datasets
BarChartDataset[]
[]
One or more data series.
valuePolicy
SvValuePolicy
'clamp'
What to do with a bar this chart cannot draw — a negative value, `NaN`, `Infinity`. This is a zero-based bar chart: height is `(value / axisMax) * plotSize`, and an SVG rect refuses a negative height outright, so such a bar does not look wrong, it is simply absent. - `clamp` (default) — draw it at the baseline, mark it there, and disclose its real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a bar's position is its index within its group, so dropping one value would shift every later bar of that series out from under its own category label. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
orientation
BarChartOrientation
'vertical'
Chart orientation.
sort
BarChartSort
'none'
Order the categories by their total across the datasets, and slide the bars to their new places when the values change — a live leaderboard. Ties keep the input order. The data table, the keyboard order and `barSelect` keep the input order; only the picture moves, and the slide is off under `prefers-reduced-motion`.
title
string
''
Chart title.
height
number
320
Chart height in px.
barStyle
BarChartBarStyle
'bar'
How each value is drawn: `'bar'`, or `'lollipop'` — a thin stem and a dot, for many categories where bars would be a wall of ink.
options
BarChartOptions
{}
Rendering and feature options.
customClass
string
''
Additional CSS classes on the root element.
ariaLabel
string
''
Accessible-name override for the chart image. When empty, a concise data summary is generated automatically; the full data is always exposed to assistive tech via a visually-hidden table.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
barSelect
{ category: string; series: string; value: number }
Emitted when a bar is clicked — for drill-down or selection.
<sv-cylindrical-column-chart>
Also in this family — SvCylindricalColumnChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis, one per column group.
datasets
BarChartDataset[]
[]
One or more series, drawn side by side as cylindrical columns; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'clamp'
What to do with a column this chart cannot draw — a negative value, `NaN`, `Infinity`. The axis starts at zero, so such a column cannot be drawn as given, and one `NaN` would blank the whole plot. - `clamp` (default) — draw a marked stub at the baseline and disclose the real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a column's position is its index within its group. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-cylindrical-column-chart-pro>
Also in this family — SvCylindricalColumnChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis, one per column group.
datasets
BarChartDataset[]
[]
One or more series, drawn side by side as cylindrical columns; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'clamp'
What to do with a column this chart cannot draw — a negative value, `NaN`, `Infinity`. The axis starts at zero, so such a column cannot be drawn as given, and one `NaN` would blank the whole plot. - `clamp` (default) — draw a marked stub at the baseline and disclose the real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a column's position is its index within its group. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-gradient-bar-chart>
Also in this family — SvGradientBarChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis, one per bar group.
datasets
BarChartDataset[]
[]
One or more series, drawn side by side as horizontal gradient bars; set `gradientColors: [start, end]` on a series to override the gradient derived from its `color`.
valuePolicy
SvValuePolicy
'clamp'
What to do with a bar this chart cannot draw — a negative value, `NaN`, `Infinity`. This is a zero-based bar chart: height is `(value / axisMax) * plotSize`, and an SVG rect refuses a negative height outright, so such a bar does not look wrong, it is simply absent. - `clamp` (default) — draw it at the baseline, mark it there, and disclose its real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a bar's position is its index within its group, so dropping one value would shift every later bar of that series out from under its own category label. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-gradient-bar-chart-pro>
Also in this family — SvGradientBarChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis, one per bar group.
datasets
BarChartDataset[]
[]
One or more series, drawn side by side as horizontal gradient bars; set `gradientColors: [start, end]` on a series to override the gradient derived from its `color`.
valuePolicy
SvValuePolicy
'clamp'
What to do with a bar this chart cannot draw — a negative value, `NaN`, `Infinity`. This is a zero-based bar chart: height is `(value / axisMax) * plotSize`, and an SVG rect refuses a negative height outright, so such a bar does not look wrong, it is simply absent. - `clamp` (default) — draw it at the baseline, mark it there, and disclose its real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a bar's position is its index within its group, so dropping one value would shift every later bar of that series out from under its own category label. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-column-drilldown-chart>
Also in this family — SvColumnDrilldownChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Top-level category labels on the X-axis; a drilled-into level shows its own `categories` instead.
datasets
DrilldownDataset[]
[]
Top-level series. A series whose `drilldown` map has an entry for a category makes that column clickable, switching the chart to the sub-level.
valuePolicy
SvValuePolicy
'clamp'
What to do with a column this chart cannot draw — a negative value, `NaN`, `Infinity` — at whichever level is showing. Hiding such a column would also hide its drill-down, and one `NaN` would blank the axis. - `clamp` (default) — draw a marked stub at the baseline and disclose the real value under the plot. - `reject` — refuse the level and show the error state. `omit` is not available: a column's position is its category index. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
rootTitle
string
'Root'
Label of the first breadcrumb, which stands for the top level and stays visible while drilled down.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-column-drilldown-chart-pro>
Also in this family — SvColumnDrilldownChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Top-level category labels on the X-axis; a drilled-into level shows its own `categories` instead.
datasets
DrilldownDataset[]
[]
Top-level series. A series whose `drilldown` map has an entry for a category makes that column clickable, switching the chart to the sub-level.
valuePolicy
SvValuePolicy
'clamp'
What to do with a column this chart cannot draw — a negative value, `NaN`, `Infinity` — at whichever level is showing. Hiding such a column would also hide its drill-down, and one `NaN` would blank the axis. - `clamp` (default) — draw a marked stub at the baseline and disclose the real value under the plot. - `reject` — refuse the level and show the error state. `omit` is not available: a column's position is its category index. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
rootTitle
string
'Root'
Label of the first breadcrumb, which stands for the top level and stays visible while drilled down.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-range-column-chart>
Also in this family — SvRangeColumnChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis.
datasets
RangeChartDataset[]
[]
One or more range series — each data point has `{ low, high }`.
valuePolicy
SvValuePolicy
'omit'
What to do with a range this chart cannot draw — a `NaN` or unbounded end, a low below zero (the axis starts at zero, so it would hang outside the plot), or a high below its low. One `NaN` would blank the axis. - `omit` (default) — leave the range out and say how many under the plot. Safe here: every range keeps its own slot, so no other bar moves. - `reject` — refuse the dataset and show the error state.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-range-column-chart-pro>
Also in this family — SvRangeColumnChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis.
datasets
RangeChartDataset[]
[]
One or more range series — each data point has `{ low, high }`.
valuePolicy
SvValuePolicy
'omit'
What to do with a range this chart cannot draw — a `NaN` or unbounded end, a low below zero (the axis starts at zero, so it would hang outside the plot), or a high below its low. One `NaN` would blank the axis. - `omit` (default) — leave the range out and say how many under the plot. Safe here: every range keeps its own slot, so no other bar moves. - `reject` — refuse the dataset and show the error state.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
height
number
320
Chart height in px.
rangeStyle
RangeChartStyle
'bar'
`'bar'`, or `'dumbbell'` — two dots joined by a line, from low to high.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-range-bar-chart>
Also in this family — SvRangeBarChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis.
datasets
RangeChartDataset[]
[]
One or more range series — each data point has `{ low, high }`.
valuePolicy
SvValuePolicy
'omit'
What to do with a range this chart cannot draw — a `NaN` or unbounded end, a low below zero (the axis starts at zero, so it would hang outside the plot), or a high below its low. One `NaN` would blank the axis. - `omit` (default) — leave the range out and say how many under the plot. Safe here: every range keeps its own slot, so no other bar moves. - `reject` — refuse the dataset and show the error state.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
height
number
360
Chart height in px.
rangeStyle
RangeChartStyle
'bar'
`'bar'`, or `'dumbbell'` — two dots joined by a line, from low to high.
What to do with a column this chart cannot draw — a negative value, `NaN`, `Infinity`. The axis starts at zero, so a negative height would draw nothing, and one `NaN` would blank the whole plot. - `clamp` (default) — draw a marked stub at the baseline and disclose the real value under the plot. - `reject` — refuse the dataset and show the error state. `omit` is not available: a column's position is its category index. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
height
number
320
Chart height in px.
options
BarChartOptions
{}
Rendering options: `showGrid`, `showLabels`, `showLegend`, `showValues`, `barGap` (default 0.25), `barRadius` (default 4), `placementRatio` (foreground width as a fraction of the background, default 0.5) and `animationDuration`.
customClass
string
''
Additional CSS classes on the root element.
ariaLabel
string
''
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-negative-stack-chart>
Also in this family — SvNegativeStackChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis, one per bar group.
datasets
BarChartDataset[]
[]
Series stacked out from a centred zero axis: negative values stack leftward and positive values rightward (e.g. a population pyramid).
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-stacked-bar-chart>
Also in this family — SvStackedBarChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis, one per bar group.
datasets
BarChartDataset[]
[]
Series stacked end to end into one horizontal bar per category; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'omit'
What to do with a segment a stack cannot draw — a negative value, `NaN`, `Infinity`. A stack only adds positive parts, and one `NaN` would blank the axis. - `omit` (default) — leave the segment out and say how many under the plot. Safe here: a segment's place is in its stack, so no other bar moves. - `reject` — refuse the dataset and show the error state. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-axis-label-template-chart>
Also in this family — SvAxisLabelTemplateChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
AxisLabelCategory[]
[]
X-axis categories; each renders its label plus an optional icon, colour swatch and sub-label.
datasets
AxisLabelTemplateDataset[]
[]
Bar series; each `data` array is indexed by category position and drawn as grouped bars.
title
string
''
Chart title rendered above the plot; also the base of the generated accessible name and the data table's caption.
height
number
340
Chart height in pixels.
options
AxisLabelTemplateOptions
{}
Display options: grid, legend, value labels, bar gap ratio and animation duration.
customClass
string
''
Extra CSS classes applied to the root wrapper.
ariaLabel
string
''
Accessible-name override for the plot; otherwise a series summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
barHover
AxisLabelBarEvent
Emitted when a bar is hovered or keyboard-focused.
barSelect
AxisLabelBarEvent
Emitted when a bar is clicked or activated via keyboard (Enter/Space).
<sv-axis-label-template-chart-pro>
Also in this family — SvAxisLabelTemplateChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
AxisLabelCategory[]
[]
X-axis categories; each renders its label plus an optional icon, colour swatch and sub-label.
datasets
AxisLabelTemplateDataset[]
[]
Bar series; each `data` array is indexed by category position and drawn as grouped bars.
title
string
''
Chart title rendered above the plot; also used as the plot's accessible name.
height
number
340
Chart height in pixels.
options
AxisLabelTemplateOptions
{}
Display options: grid, legend, value labels, bar gap ratio and animation duration.
customClass
string
''
Extra CSS classes applied to the root wrapper.
ariaLabel
string
''
Accessible-name override for the plot; otherwise a series summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
barHover
AxisLabelBarEvent
Emitted when a bar is hovered or keyboard-focused.
barSelect
AxisLabelBarEvent
Emitted when a bar is clicked or activated via keyboard (Enter/Space).
<sv-multi-level-label-chart>
Also in this family — SvMultiLevelLabelChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Leaf-level category labels shown directly on the axis
levels
MultiLevelAxisLevel[]
[]
Additional grouping levels — level[0] groups categories, level[1] groups level[0], etc.
datasets
MultiLevelDataset[]
[]
Bar series; each `data` array is indexed by leaf category position and drawn as grouped bars.
title
string
''
Chart title rendered above the plot; also used as the plot's accessible name.
height
number
360
Chart height in pixels, including the grouped axis-label rows.
options
MultiLevelLabelOptions
{}
Display options: grid, legend, value labels, bar gap ratio and animation duration.
customClass
string
''
Extra CSS classes applied to the root wrapper.
ariaLabel
string
''
Accessible-name override for the plot; otherwise a series summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
barHover
MultiLevelBarEvent
Emitted when a bar is hovered or keyboard-focused.
barSelect
MultiLevelBarEvent
Emitted when a bar is clicked or activated via keyboard (Enter/Space).
<sv-live-update-chart>
Also in this family — SvLiveUpdateChartComponent from @styloviz/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
title
string
'Revenue & Expenses'
Chart title, rendered in the header and used in the default accessible name.
ariaLabel
string
''
Accessible-name override for the chart image.
categories
string[]
['Jan', …, 'Dec']
X-axis category labels; each dataset's `data[i]` is plotted against `categories[i]`.
sources
LiveUpdateSource[]
[]
Switchable data sets, one toggle button each; the bars animate between them and the Y-axis is fixed to the max across all sources. The first source is active on init; an empty array shows the empty state.
options
LiveUpdateChartOptions
{}
Height, bar transition duration, corner radius, and value-label/grid/legend toggles — see `LiveUpdateChartOptions`.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-live-update-chart-pro>
Also in this family — SvLiveUpdateChartProComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
title
string
'Revenue & Expenses'
Chart title, rendered in the header and used in the default accessible name.
ariaLabel
string
''
Accessible-name override for the chart image.
categories
string[]
['Jan', …, 'Dec']
X-axis category labels; each dataset's `data[i]` is plotted against `categories[i]`.
sources
LiveUpdateSource[]
[]
Switchable data sets, one toggle button each; the bars animate between them and the Y-axis is fixed to the max across all sources. The first source is active on init; an empty array shows the empty state.
options
LiveUpdateChartOptions
{}
Height, bar transition duration, corner radius, and value-label/grid/legend toggles — see `LiveUpdateChartOptions`.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-stacked-bar-percent-chart>
Also in this family — SvStackedBarPercentChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the Y-axis, one per bar group.
datasets
BarChartDataset[]
[]
Series stacked into one horizontal bar per category, normalised so every bar spans 100 %; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'omit'
What to do with a segment a stack cannot draw — a negative value, `NaN`, `Infinity`. A stack only adds positive parts, and one `NaN` would blank the axis. - `omit` (default) — leave the segment out and say how many under the plot. Safe here: a segment's place is in its stack, so no other bar moves. - `reject` — refuse the dataset and show the error state. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-stacked-column-chart>
Also in this family — SvStackedColumnChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis, one per column group.
datasets
BarChartDataset[]
[]
Series stacked bottom to top into one column per category; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'omit'
What to do with a segment a stack cannot draw — a negative value, `NaN`, `Infinity`. A stack only adds positive parts, and one `NaN` would blank the axis. - `omit` (default) — leave the segment out and say how many under the plot. Safe here: a segment's place is in its stack, so no other bar moves. - `reject` — refuse the dataset and show the error state. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
<sv-stacked-column-percent-chart>
Also in this family — SvStackedColumnPercentChartComponent from @styloviz-pro/charts.
Async states
loading
empty
error
retry
Inputs
Name
Type
Default
Description
loading
boolean
false
True while the series are being fetched.
error
SvDataError | string | null
null
Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessage
string
'No data to plot'
Copy for the empty state.
filtered
boolean
false
Whether a filter, not an absence of data, is why the chart is empty.
categories
string[]
[]
Category labels on the X-axis, one per column group.
datasets
BarChartDataset[]
[]
Series stacked into one column per category, normalised so every column spans 100 %; each `data` array holds one value per category.
valuePolicy
SvValuePolicy
'omit'
What to do with a segment a stack cannot draw — a negative value, `NaN`, `Infinity`. A stack only adds positive parts, and one `NaN` would blank the axis. - `omit` (default) — leave the segment out and say how many under the plot. Safe here: a segment's place is in its stack, so no other bar moves. - `reject` — refuse the dataset and show the error state. For data that genuinely goes below zero, use `<sv-negative-stack-chart>`.
title
string
''
Heading shown above the chart (omitted when empty); also used in the generated accessible name.
Accessible-name override; otherwise a structure summary is generated.
Outputs
Event
Payload type
Description
retry
void
The host should re-run the failed load.
Wire it to your API
This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.
Template
Bound to the names this component actually exposes.
This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `datasets`, `loading` and `error`.
Set `filtered` when a search or filter is active. It is the difference between "you have no orders" and "no orders match this filter" — telling a customer with 4,000 orders the first one reads as a bug.
Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.
Grouped, stacked and 100%-stacked modes, with each category's absolute total drawn beside its bar on the normalised ones (`showCategoryTotals`, on by default).
Animated entrance with configurable colors.
Handle `barSelect` for drill-down or selection.
`valuePolicy` decides what happens to a bar this chart cannot draw — a negative, `NaN` or `Infinity`. `clamp` (default) draws it as a marked 3px stub at the baseline; `reject` refuses the dataset and shows the error state. `omit` is not offered: a bar's position is its index within its group, so dropping one would slide every later bar out from under its own category label. The cylindrical, placement and drilldown columns take the same `clamp`/`reject` choice. The stacked and range variants default to `omit` instead — a segment or a range keeps its own slot, so leaving one out moves nothing else — and count what they left out under the plot. For data that genuinely goes below zero use `<sv-negative-stack-chart>`.
Pro (`sv-bar-chart-pro`): error bars — `errors` on a dataset, a ± per value or `{ minus, plus }` — and `barStyle="lollipop"`, a stem and a dot per value. The range charts take `rangeStyle="dumbbell"`.
Best practices
Do: Order categories meaningfully (by value or time), not arbitrarily.
Do: Use horizontal orientation when category labels are long.
Don't: Don't truncate the value axis baseline away from zero — it distorts comparisons.
Do: Leave showCategoryTotals on for the 100 %-stacked variants. Normalising is what those charts are for and also the one thing they hide: every bar is drawn the same length, so two categories look identical when one is ten times the other. The total beside each bar is the only thing in the picture that says which — a tooltip does not count, because the reader who is misled here is precisely the one who thinks the bars are comparable and therefore never hovers.
Don't: Do not compare two bars in a 100 % stack by eye and conclude anything about volume. Their lengths are equal by construction. Read the composition off the segments and the magnitude off the total.
Tip: The cylindrical columns (`sv-cylindrical-column-chart-pro`) and the gradient bars (`sv-gradient-bar-chart-pro`) are DECORATIVE treatments. The cylinder's caps and shading and the gradient's fade encode nothing — the bar's length is the whole datum, exactly as in the plain bar chart — and they spend ink that carries no data. Use them where the chart is a hero visual on a marketing or summary surface; reach for the plain bar chart where readers compare values closely, and never read a gradient's lighter end as a smaller value.
Accessibility
The SVG is a `role="group"` with an auto-generated data summary as its name (override via `ariaLabel`) — `group`, not `img`, because focusable bars inside an `img` are invisible to a screen reader, which prunes its subtree.
A bar's height is its value, so `sv-data-summary-table` publishes the numbers beside it: one row per category, one column per series, captioned with the chart title. There is deliberately no overview line above it — the SVG's own name already states the series and the category count, and repeating it is the same sentence twice.
Numeric value labels accompany bars; respects reduced-motion for animations.
A clamped bar is disclosed three ways, because the stub alone is only visual: a sentence under the plot naming how many bars and their real values, "not drawn to scale" appended to the bar's own `aria-label`, and the same phrase in its table cell. The table keeps the REAL number — it is the data, not a transcript of the drawing.
A blank source cell reads as "no value", not `NaN`. `Math.max(10, NaN)` is `NaN`, so a blank read as `NaN` would take the axis, every bar height and every grid tick with it — and SVG drops a `NaN` dimension silently, blanking the plot with no error anywhere.
On a 100 %-stacked chart the absolute total is drawn beside every bar, so the magnitude that normalising removes is present as text rather than only in a tooltip. A negative contribution is excluded from the total exactly as it is from the segments, so the caption always equals the sum of what is actually drawn.
The Gradient Bar variant publishes the same table. Its bars are not focusable, so a per-bar `aria-label` had nothing to attach to and the SVG's name says only how many series there are — every number on it reached the page as a gradient length and nothing else.
The chart accessibility module puts the same table on screen: `svChartDataTable` on the chart, or `provideSvChartA11y({ dataTable: 'toggle' })` for the app, adds a “Show data table” button under the plot (`aria-expanded`, `aria-controls`; the visible table is a named, focusable scroll region). Every chart in the kit supports it.
An error range is spoken, not only drawn: “60 (−4, +12)” in the bar's name, its tooltip and its table cell; the whisker itself is `aria-hidden`.
Feedback on Bar Chart
Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.
Loads giscus.app and GitHub — nothing is fetched until you click.