Loading component…
Loading component…
Stacked bar chart with measure, slice and segment pickers, a hover breakdown and a linked table
To reuse this local React demo, copy all files from the Code tab into the same folder, then import BreakdownChart from ./breakdown-chart.
import { BreakdownChart } from "@/components/ui/breakdown-chart";
const dimensions = [
{ key: "status", label: "Status", values: ["Todo", "In progress", "Done"] },
{ key: "priority", label: "Priority", values: ["High", "Medium", "Low"], colors: { High: "#e5484d" } },
];
const measures = [
{ key: "count", label: "Task count", unit: "tasks" },
{ key: "points", label: "Story points", unit: "points", field: "points" },
];
export function Sprint({ tasks }) {
return <BreakdownChart title="Sprint 24" records={tasks} dimensions={dimensions} measures={measures} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| records | BreakdownRecord[] | Flat records – one per task, ticket or order – with a field per dimension | |
| dimensions | Dimension[] | key, label, values in order, optional colors and icons per value | |
| measures | Measure[] | key, label, unit and the field to sum – without a field records are counted | |
| title | string | "Workload" | Heading in the gray tray |
| defaultMeasure | string | Measure shown first | |
| defaultSlice | string | Dimension along the bars | |
| defaultSegment | string | Dimension that stacks the bars, or "none" | |
| className | string | Extra class on the tray |
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"