GitHubGitHub
← All widgets
Charts / widget

Bar chart

Categorical bars on ECharts: multi-series, stacked, horizontal, units, legend, and item clicks — theme-synced in light and dark.

GroupedStackedHorizontal
import { BarChart } from '@chanrg/4ui/echarts';<BarChart {categories} {series} unit="ms" stacked />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { BarChart } from '@chanrg/4ui';import { BarChart } from '@chanrg/4ui/echarts';<BarChart {categories} {series} unit="ms" stacked />

API reference

Props

PropTypeDefaultDescription
categoriesstring[][]Axis categories.
series{ name, values, color? }[][]One entry per series; null values render as gaps.
stackedbooleanfalseStack the series.
horizontalbooleanfalseFlip the axes.
onItemClick(event) => voidBar click with dataIndex/name.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Canvas rendering — pair with a DataTable for non-visual access to the numbers.

Dependencies

echarts (optional peer — install alongside)