The BarChart
component renders a standard bar chart, enabling visual comparison of numeric values across different categories. Each bar corresponds to a label and represents its associated value through height (vertical layout) or length (horizontal layout).
This example displays the count of different toy shapes — Cube
, Sphere
, and Pyramid
. The chart provides an optional toggle to switch between vertical and horizontal layouts using the labelOnYAxis
property.
labelOnYAxis?: boolean
true
, labels will be displayed on the Y-axis, and bars will be rendered horizontally.false
(default), labels appear on the X-axis, and bars are rendered vertically.marks: Array<object>
(required)Each data point defines a bar and includes:
label: string | Date
The name or identifier for the category.
value: number
The numeric value represented by the bar.
unit?: CalendarComponent
(optional)
Used when displaying time-based values.
Optional ChartMarkProps
Provides additional customization, such as:
foregroundStyle
opacity
cornerRadius
symbol
annotation
The BarChart
component is ideal for: