Charts / React chart kit primitives / Comparison
Stacked or grouped bars with a y-axis, a highlighted bar and hover tooltips; here spend and return by channel.
React component BarChart, data through props. Side by side: who, which source, which version is ahead. Tags: bar, column, stacked, grouped, categories, tooltip, axis.
npm i klar-charts
import 'klar-charts/styles.css'
import { ThemeScope, BarChart } from 'klar-charts'
# or copy the source:
npx shadcn@latest add https://klar.run/r/kit-bar-chart.json<BarChart
className="mt-5"
height={230}
data={data}
highlightIndex={0}
formatY={(v) => `${Math.round(v)}K`}
formatTooltip={(v) => `${v.toFixed(1)}K`}
series={[
{ key: 'spend', label: 'Spend', color: 'color-mix(in oklab, var(--accent) 45%, var(--surface-4))' },
{ key: 'revenue', label: 'Return', color: 'var(--accent)' },
]}
/>