Trend · Intermediate

Bump chart

Rank changes over time.

Open in playground
Use when
What matters is the rank, as in App Store rankings
Avoid when
The value gaps between ranks matter

Try it

29

Bump chart

Monthly App Store rank
Bump chartBump chart. Rank changes of 6 items, from Jan to Jul.Our app#1 Our appApp A#3 App AApp B#2 App BApp C#5 App CApp D#4 App DApp E#6 App E
Bump chart data
Jan#1 App A, #2 App B, #3 App C, #4 App D, #5 Our app, #6 App E
Feb#1 App A, #2 App C, #3 App B, #4 Our app, #5 App D, #6 App E
Mar#1 App B, #2 App A, #3 App C, #4 Our app, #5 App E, #6 App D
Apr#1 App B, #2 App A, #3 Our app, #4 App C, #5 App D, #6 App E
May#1 App B, #2 Our app, #3 App A, #4 App C, #5 App D, #6 App E
Jun#1 App B, #2 Our app, #3 App A, #4 App D, #5 App C, #6 App E
Jul#1 Our app, #2 App B, #3 App A, #4 App D, #5 App C, #6 App E
From 5th to 1stIntermediate

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

Code

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

const data = [
  {"month":"Jan","app":"Our app","rank":5},
  {"month":"Feb","app":"Our app","rank":4},
  {"month":"Mar","app":"Our app","rank":4},
  {"month":"Apr","app":"Our app","rank":3},
  {"month":"May","app":"Our app","rank":2},
  {"month":"Jun","app":"Our app","rank":2},
  // … 36 more rows
];

export function Example() {
  return (
    <ChartCard number="29" title="Bump chart" subtitle="Monthly App Store rank" takeaway="From 5th to 1st" level="intermediate" replay>
      <BumpChart
        data={data}
        x="month"
        series="app"
        rank="rank"
      />
    </ChartCard>
  );
}

Props

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

26 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
xRequiredPeriod fieldstring | (d, i) => any
seriesRequiredItem fieldstring | (d, i) => string
rankRank field (1 is first)string | (d, i) => number
valueValue field (instead of rank, largest is first)string | (d, i) => number
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>