Comparison · Intermediate

Pareto chart

Bars sorted largest first with a cumulative share line.

Open in playground
Use when
Seeing how few items make up 80% of the total
Avoid when
The item order means something (time order, for example)

Try it

08

Pareto chart

Ad spend share by keyword (%)
  • Share
  • Cumulative
Pareto chartPareto chart. 10 items, the top 2 add up to 79%.80%79%
Pareto chart data
running shoes54 · share 54% · cumulative 54%
marathon shoes25 · share 25% · cumulative 79%
best sneakers7 · share 7% · cumulative 86%
cushioned shoes4 · share 4% · cumulative 90%
trail shoes3 · share 3% · cumulative 93%
light shoes2.5 · share 3% · cumulative 96%
running socks2 · share 2% · cumulative 98%
insoles1.2 · share 1% · cumulative 99%
running belt0.8 · share 0.8% · cumulative 100%
wristband0.5 · share 0.5% · cumulative 100%
Do the top 20% make 80%?Intermediate

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 pareto --variant <id>) and the MCP server know the same names.

70% line

Ad spend share by keyword (%)
  • Share
  • Cumulative
Sample data

Names on the axis

Ad spend share by keyword (%)
  • Share
  • Cumulative
Sample data

Code

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

const data = [
  {"keyword":"running shoes","spend":54},
  {"keyword":"marathon shoes","spend":25},
  {"keyword":"best sneakers","spend":7},
  {"keyword":"cushioned shoes","spend":4},
  {"keyword":"trail shoes","spend":3},
  {"keyword":"light shoes","spend":2.5},
  // … 4 more rows
];

export function Example() {
  return (
    <ChartCard number="08" title="Pareto chart" subtitle="Ad spend share by keyword (%)" takeaway="Do the top 20% make 80%?" level="intermediate" legend={[{"label":"Share","color":"neutral"},{"label":"Cumulative","color":"ink","shape":"line"}]} replay>
      <ParetoChart
        data={data}
        label="keyword"
        value="spend"
        rankLabels={true}
      />
    </ChartCard>
  );
}

Props

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

27 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
labelRequiredItem name fieldstring | (d, i) => string
valueRequiredValue fieldstring | (d, i) => number
thresholdReference line (%)numberDefault 80
sortSort largest firstbooleanDefault true
rankLabelsShow ranks instead of names as x labelsbooleanDefault 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>