Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

BarChart

Bars, vertical or horizontal, side by side or stacked.

import { BarChart } from '@loidolt/theme-charts';

Example

First four months by material

Bar chart of 3 series over 4 categories, Jan to Apr. Birch ply rises, from a low of 42 in Jan to a high of 92 in 11; Cork rises, from a low of 18 in Jan to a high of 41 in 11; Acrylic rises, from a low of 10 in Feb to a high of 26 in 12.

Sheets used this year

Bar chart of 1 series over 5 categories, Birch ply to Card. Sheets falls, from a low of 88 in Card to a high of 812 in Birch ply.

Sheets used this year
MaterialSheets
Birch ply812
Cork351
Acrylic212
MDF140
Card88

Notes

  • Horizontal bars suit long category names and read top-down in data order.
  • decal adds a pattern to each series, so a reader never has to tell series apart by colour alone.

Props

Generated from the component source, so it cannot drift from the implementation.

BarChart props
PropTypeDefaultNotes
data required CategoryData—Categories and a series of values for each.
categoryLabel string'Category'Heading of the first column in the data table.

Plus the attributes of Omit<ComponentProps<typeof Chart>, 'option' | 'table' | 'extensions'>andBarOptions, forwarded to the root element.