Comparison · Intermediate

Dumbbell chart

The gap between two values per item (before and after, target and actual).

Open in playground
Use when
The gap is the story, such as before and after an improvement by region
Avoid when
There is only one value

Try it

22

Dumbbell chart

Purchase conversion rate by region (%)
Dumbbell chartDumbbell chart. Seoul 3.2%→4.6%, Gyeonggi 2.8%→3.9%, Incheon 2.3%→3.1%, Busan 2.1%→2.6%, Daejeon 1.7%→2.4%, Daegu 1.9%→2.2%, Gwangju 1.6%→1.8%.Seoul4.6Gyeonggi3.9Incheon3.1Busan2.6Daejeon2.4Daegu2.2Gwangju1.8
Dumbbell chart data
Seoul2024 3.2% → 2025 4.6%
Gyeonggi2024 2.8% → 2025 3.9%
Incheon2024 2.3% → 2025 3.1%
Busan2024 2.1% → 2025 2.6%
Daejeon2024 1.7% → 2025 2.4%
Daegu2024 1.9% → 2025 2.2%
Gwangju2024 1.6% → 2025 1.8%
Seoul rose the mostIntermediate

Hover over the chart, or Tab in and use the arrow keys to move between items. The numbers are sample data.

Variants

Named looks for this chart. Each one is the example above with a few options or fields changed. The CLI (ztd-charts example dumbbell --variant <id>) and the MCP server know the same names.

Data order

Purchase conversion rate by region (%)
Sample data

From zero

Purchase conversion rate by region (%)
Sample data

Code

DumbbellChart.tsx
import { ChartCard, DumbbellChart } from "ztd-charts";

const data = [
  {"region":"Seoul","before":3.2,"after":4.6},
  {"region":"Gyeonggi","before":2.8,"after":3.9},
  {"region":"Busan","before":2.1,"after":2.6},
  {"region":"Daegu","before":1.9,"after":2.2},
  {"region":"Incheon","before":2.3,"after":3.1},
  {"region":"Gwangju","before":1.6,"after":1.8},
  // … 1 more row
];

export function Example() {
  return (
    <ChartCard number="22" title="Dumbbell chart" subtitle="Purchase conversion rate by region (%)" takeaway="Seoul rose the most" level="intermediate" replay>
      <DumbbellChart
        data={data}
        label="region"
        start="before"
        end="after"
        labels={["2024","2025"]}
        unit="%"
      />
    </ChartCard>
  );
}

Props

<DumbbellChart> takes these props. Rows marked Common work the same on every chart.

28 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
labelRequiredItem name fieldstring | (d, i) => string
startRequiredBefore valuestring | (d, i) => number
endRequiredAfter valuestring | (d, i) => number
labelsLegend names [before, after]string[]
sortSort by the after valuebooleanDefault true
zeroInclude 0 on the axisbooleanDefault false
heightCommonHeight in px. Without it, each chart picks a default that fits its widthnumber
widthCommonFixed width in px. Without it, the chart fits its parentnumber
highlightCommonItem to highlight. An index, a name, an array, or "max" | "min" | "first" | "last" | "none"number | string | (number|string)[] | "max" …
formatCommonValue format. "number" | "integer" | "percent" (values are already percents: 42 → "42%") | "ratio" (0.42 → "42%") | "compact" | "currency" (KRW for Korean locales, otherwise USD; for another currency pass Intl options with currency) | "decimal" or Intl.NumberFormat options"number" | "percent" | "compact" | …
unitCommonUnit appended to values. For example "%" or "ms"string
localeCommonLocale for numbers, dates and the text a chart writes itself (tooltips, screen reader sentences). "ko" or "ko-*" switches to Korean. Falls back to the ThemeProvider localestringDefault "en-US"
animateCommonEntry and update animationbooleanDefault true
durationCommonAnimation length (ms)number
easingCommonMotion curve"spring" | "easeOut" | "easeInOut" | "linear"Default "spring"
staggerCommonDelay between items as they enter (ms)number
reducedMotionCommon"auto" follows the OS setting. true always turns motion offanyDefault "auto"
animateOnViewCommonPlay when the chart scrolls into viewbooleanDefault true
showLabelsCommonLabels drawn on the chart (values and names)booleanDefault true
tooltipCommonShow tooltips. { template: "{label} · {value} · owner {owner}" } writes them: {label}, {value}, {series} or any other column of the row. \n starts a new line, and a line with an empty value is left outtooltipDefault true
syncIdCommonCharts with the same syncId show the hovered x together (line, area, bar, candlestick). <ChartGrid sync> sets one for every chart inside itstring
ariaLabelCommonName for screen readersstring
descriptionCommonDescription for screen readers. Built from the data when omittedstring
onHoverCommonRuns when hover or keyboard focus moves to another item(e: ChartEvent | null) => void
onClickCommonRuns on click, Enter or Space(e: ChartEvent) => void
replayKeyCommonReplays the entry animation when it changesstring | number
themeCommonChanges theme tokens for this chart onlyPartial<ChartTheme>