Chart
Render supported data visualizations from structured data.
Overview
Chart renders a small, read-only bar, line, or pie dataset with hover and keyboard value disclosure plus an exact accessible data table. It is not a general charting engine, data-fetching layer, or application state manager.
Use when
A small, bounded dataset benefits from a visual comparison and the exact values remain available in the built-in data table.
Use instead
Use Table when scanning or copying exact values is the main task. Use a specialised charting library when you need custom axes, formatters, annotations, data fetching, drill-down, or application-owned chart state.
Usage
Weekly signups
Signups peaked on Tuesday.
| Label | Signups |
|---|---|
| Mon | 12 |
| Tue | 18 |
| Wed | 15 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const data = {
type: "bar",
labels: ["Mon", "Tue", "Wed"],
datasets: [{ label: "Signups", data: [12, 18, 15] }],
} satisfies ChartData;
<Chart title="Weekly signups" description="Signups peaked on Tuesday." data={data} />Examples
Start with a bounded comparison
Chart data is an ordered snapshot. Each dataset needs exactly one finite value for every label; Chart validates the shape before rendering the plot and exact-value table.
Weekly signups
Signups peaked on Thursday.
| Day | Signups |
|---|---|
| Mon | 12 |
| Tue | 18 |
| Wed | 15 |
| Thu | 21 |
| Fri | 17 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const weeklySignups = {
type: "bar",
labels: ["Mon", "Tue", "Wed", "Thu", "Fri"],
datasets: [{ label: "Signups", data: [12, 18, 15, 21, 17] }],
} satisfies ChartData;
<Chart
title="Weekly signups"
description="Signups peaked on Thursday."
xAxisLabel="Day"
yAxisLabel="Signups"
data={weeklySignups}
/>Compare series with a named legend
A legend appears automatically when a chart has more than one dataset. Use a specific text label for every series; color is only a supporting cue.
Qualified opportunities by source
Product-led opportunities increased in April.
| Month | Product-led | Partner-led |
|---|---|---|
| Jan | 24 | 12 |
| Feb | 31 | 15 |
| Mar | 29 | 18 |
| Apr | 38 | 16 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const acquisitionBySource = {
type: "line",
labels: ["Jan", "Feb", "Mar", "Apr"],
datasets: [
{ label: "Product-led", data: [24, 31, 29, 38] },
{ label: "Partner-led", data: [12, 15, 18, 16] },
],
} satisfies ChartData;
<Chart
title="Qualified opportunities by source"
description="Product-led opportunities increased in April."
xAxisLabel="Month"
yAxisLabel="Opportunities"
data={acquisitionBySource}
showLegend
legendInteraction="click"
/>Show composition with stacked bars
Use stacked bars only when the series form an additive total for each category. stacked100 is for comparing shares, not absolute amounts. Both stacked variants reject negative values.
Qualified pipeline by region
- Standard
- Enterprise
| Region | Standard | Enterprise |
|---|---|---|
| North | 18 | 7 |
| South | 12 | 9 |
| West | 14 | 6 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const planMix = {
type: "bar",
labels: ["North", "South", "West"],
datasets: [
{ label: "Standard", data: [18, 12, 14] },
{ label: "Enterprise", data: [7, 9, 6] },
],
} satisfies ChartData;
<Chart
title="Qualified pipeline by region"
xAxisLabel="Region"
yAxisLabel="Opportunities"
data={planMix}
barVariant="stacked"
/>Use a pie chart for one positive whole
Pie accepts exactly one dataset with non-negative values and at least one positive value. Use it for a small set of parts of one whole, not a trend or a comparison across measures.
Team time by work type
Hours recorded this week.
- Product work
- Customer support
- Operations
| Label | Hours |
|---|---|
| Product work | 42 |
| Customer support | 28 |
| Operations | 30 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const workByType = {
type: "pie",
labels: ["Product work", "Customer support", "Operations"],
datasets: [{ label: "Hours", data: [42, 28, 30] }],
} satisfies ChartData;
<Chart
title="Team time by work type"
description="Hours recorded this week."
data={workByType}
/>Reduce visual label density without losing data
xAxisLabelMode changes only the labels drawn on a cartesian plot. The focusable plot targets and exact accessible table keep every category and value available.
Daily product events
| Label | Events |
|---|---|
| 1 Oct | 8 |
| 2 Oct | 11 |
| 3 Oct | 7 |
| 4 Oct | 14 |
| 5 Oct | 13 |
| 6 Oct | 16 |
| 7 Oct | 12 |
import { Chart, type ChartData } from "@smoothie-framework/whisk-react";
const dailyEvents = {
type: "line",
labels: ["1 Oct", "2 Oct", "3 Oct", "4 Oct", "5 Oct", "6 Oct", "7 Oct"],
datasets: [{ label: "Events", data: [8, 11, 7, 14, 13, 16, 12] }],
} satisfies ChartData;
<Chart
title="Daily product events"
data={dailyEvents}
lineVariant="area"
lineStyle="dashed"
showPoints={false}
xAxisLabelMode="endpoints"
/>Props
Component props
Accessibility
Chart renders a labelled group, a visible heading, an SVG plot, focusable category or slice targets, and a visually hidden native table containing the exact source values. Hover and focus show the same tooltip; Escape dismisses an open tooltip. The legend pairs each color with a text label, and interactive legends are real buttons. Write a specific title, meaningful dataset labels, and axis labels where the measure is not already clear. Do not rely on color, the plot, or an automatic summary alone to communicate an important conclusion. Chart does not provide arrow-key navigation, activation, drill-down, or data-update announcements.
Content guidance
Name the measure and time frame in the title, and use a description to explain the takeaway or comparison. Keep dataset and category labels specific enough to stand alone in the legend, tooltip, and data table.