Skip to content
InsightCharts

Search

Search guides and components

Dumbbell chart

Shows two values per category as dots joined by a line, so the length of the line shows the difference.

Use when
Before / after or group A / group B across up to about 20 categories, when the size of the difference is what the reader needs.
Avoid when
A single value per category (use lollipop chart or bar chart); when the direction of change matters more than the two levels (use arrow chart); more than two points in time (use slope chart or line chart).

Preview

Life expectancy in South Korea rose from 76.0 years in 2000 to 83.6 in 2023

Life expectancy at birth, years, 2000 and 2023

Source: OECD Health Statistics (rounded) · Figures are approximate, for illustration

Composition

Used in

1 template uses dumbbell chart.

Templates

1

A one-page summary. It has a headline that states the main finding with its number, a deck, a row of three or four key figures, one hero chart with a takeaway callout, two smaller supporting exhibits, a short list of actions and a source note.

Installation

$ pnpm dlx shadcn@latest add @insightcharts/dumbbell-chart

The CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:

import { DumbbellChart } from "insightcharts";

Examples

Two groups, highlighted row

Women in South Korea earned 68.8% of men's median pay in 2022

Median full-time earnings, men = 100

Source: OECD gender wage gap, 2022 (rounded) · Figures are approximate, for illustration

Long format

Rent in Lisbon rose from €860 in 2015 to €1,720 in 2024

Typical monthly rent for a one-bedroom flat, euros

Illustrative figures.

Stress: 22 rows, long names, axis instead of labels

Remote working in information and communication rose from 48% in 2019 to 66% in 2024

Share of employees working from home at least one day a week, by sector

Illustrative figures.

Props

PropTypeDefaultDescription
categoryrequiredstringCategory field: one row of the chart each.
fromrequiredstringField with the first value, or (long data) the series value that marks it.
torequiredstringField with the second value, or (long data) the series value that marks it.
seriesstringLong data: the field whose values are from and to.
valuestring"value"Long data: the measure field.
kind"change" | "groups""change"change draws a tint then the accent (before / after); groups uses two hues (two peers).
sort"gap" | "from" | "to" | "none""gap"Row order.
order"desc" | "asc""desc"Sort direction.
labelsbooleanValue labels beside both dots. Default: on for up to 14 rows; otherwise a value axis is drawn.
gapLabelboolean | stringfalsePrint the gap in a right-hand column; a string sets the column header.
zerobooleanfalseStart the value axis at zero.
namesRecord<string, string>Display names for the from and to keys.
Common chart props 29

Every chart built with defineChart accepts these on top of its own props.

PropTypeDescription
dataDataInputRows, CSV text, a URL, { url, path }, an async function, or an Arrow-style table. Omit inside <InsightData>.
transformTransform | Transform[]A pipeline of transforms applied before drawing.
titlestringThe title. One plain statement of what the data shows, with the number and the period ("Monthly churn fell from 4.2% to 2.1% in 2024"), or a plain label ("Monthly churn, 2024"). One clause, no figures of speech.
subtitlestringMeasure, unit, population, period.
sourcestringData source, shown as "Source: ...".
notestringMethod notes or caveats.
heightnumber | stringCSS height of the plot. Default 360.
aspectnumberWidth / height. Overrides height.
highlightstring | string[]The entity (or entities) the title is about. Every other series is drawn in grey.
annotationsAnnotation[]Reference lines, shaded bands and callouts, in data coordinates.
formatFormatSpecHow to print values: "compact", "percent", "currency:USD", "{value} kg", Intl options, or a function.
legendbooleanShow the legend. Default: shown when there are two or more series.
selectboolean | stringMake marks clickable to filter. Inside <InsightData> the selection filters every other chart. Pass a field name, or true to use the chart's category field.
onSelect(values: string[], field: string) => voidCalled with the selected values whenever the selection changes.
optionEChartsOption | ((option: EChartsOption, ctx: BuildContext) => EChartsOption)Deep-merged over the generated ECharts option, or a function that receives and returns it. Use it for ECharts settings no prop covers.
themeThemeInputA theme, or a partial set of tokens merged over the surrounding theme, for this chart only.
modeModeInput"auto" (default) follows the page, "system" follows the OS, or force "light" / "dark".
rendererRendererInput"auto" (default) uses SVG for light charts and canvas for heavy ones.
animatebooleanSet false to disable animation. Reduced-motion preferences are always respected.
lazybooleanMount the chart only when it scrolls near the viewport. Default true.
groupstringLink tooltips with other charts sharing this group id.
exportableboolean | ExportFormat[]Show an export menu: true or a list of formats from png, jpeg, svg, pdf, csv, json.
tablebooleanShow a collapsible "View data" table under the chart.
altstringAccessible description: the chart type and measures, then the main pattern and the notable values.
idstringStable id for this chart's selection in the shared store.
onEventsRecord<string, ChartEventHandler>ECharts event handlers, e.g. { click: (params, chart) => {} }. Prefix a name with zr: to bind to the canvas itself.
onReady(chart: EChartsInstance) => voidCalled with the ECharts instance once it is created.
classNamestringClass name for the outer <figure>.
styleCSSPropertiesInline style for the outer <figure>.