Skip to content
WunderUI

Slope Chart

Pro

Slope chart for change between columns: slope, rank shift, bump chart, dumbbell and parallel coordinates.

Playground

NPS by area

NPS by product area, 2025 to 2026: 6 items across 2025, 2026. Onboarding 42 → 58; Dashboards 51 → 49; Exports 38 → 47; Billing 29 → 41; Support 55 → 61; Mobile 33 → 44
NPS by product area, 2025 to 2026, data table
name20252026
Onboarding4258
Dashboards5149
Exports3847
Billing2941
Support5561
Mobile3344

Installation

Slope Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.

The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.

Then import what you need:

tsx
import {
  SlopeChart,
  SlopeChartProps,
  SlopeChartVariant,
} from "@wunderui/react/charts"

Then use it:

tsx
import { SlopeChart } from "@wunderui/react/charts"

const data = [
  { name: "Onboarding", y2025: 42, y2026: 58 },
  { name: "Dashboards", y2025: 51, y2026: 49 },
  { name: "Exports", y2025: 38, y2026: 47 },
]

export function NpsByArea() {
  return (
    <SlopeChart
      data={data}
      index="name"
      series={[
        { key: "y2025", label: "2025" },
        { key: "y2026", label: "2026" },
      ]}
      label="NPS by product area"
    />
  )
}

Expected result: You see three lines running from a 2025 column to a 2026 column, with the item names and values at both ends.

When to use

Use Slope Chart for

  • Change between two moments for many items: before and after
  • Rankings that move between periods (rank shift, bump chart)
  • A dumbbell per row, or parallel coordinates over several measures

Use something else for

States

Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.

NPS by area

NPS by product area, 2025 to 2026: 6 items across 2025, 2026. Onboarding 42 → 58; Dashboards 51 → 49; Exports 38 → 47; Billing 29 → 41; Support 55 → 61; Mobile 33 → 44
NPS by product area, 2025 to 2026, data table
name20252026
Onboarding4258
Dashboards5149
Exports3847
Billing2941
Support5561
Mobile3344

Keyboard interactions

The plot is focusable, and arrow keys step through the items. The live region reads each from start to end with period names, like Atlas: 10 (Q1) to 15 (Q4), and rank variants add the rank.

TaborShiftTab
Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
ArrowRightorArrowLeft
Moves to the next or previous item. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
HomeorEnd
Jumps to the first or last item.
Escape
Clears the active point.
EnterorSpace
On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.

Behavior and motion

What the chart does on its own and what the page decides.

Rows and columns
Each row of data is an item and the series list the columns: two periods for slope, rank shift and dumbbell, many for the bump chart, or axes for parallel coordinates.
Ranks
Rank variants convert values to ranks per column and join them with smooth curves. The rank order decides whether the highest value is rank 1.
Hover
Hovering an item lifts its line and dims the rest. The tooltip names the item with its value in every column and, on rank variants, its rank.
Loading, empty and error
The chart keeps its size while loading, empty or failed, so the card never jumps. Add a retry handler to show a Try again button on error.
Legend
A ChartCard shows the series as badges. With two or more series each badge switches its series off, but the last visible one stays on.
Size
The chart fills the width of its container, and you set the plot height. Text never scales, so labels keep their size at every width.

Motion

The enter sequence and the hover follow the library's motion tokens.

Draw-in
Each line is drawn along its path when the chart first comes into view, after loading and when the data changes. You can turn it off.
Reduced motion
With reduced motion the chart appears at once. The tooltip, the crosshair and every state still work.

Anatomy

A slope chart compares change between columns: before and after, rank shift, bump over many periods, a dumbbell per row, or parallel coordinates. Hovering an item lifts its line and dims the rest.

NPS by area

NPS by product area, 2025 to 2026: 6 items across 2025, 2026. Onboarding 42 → 58; Dashboards 51 → 49; Exports 38 → 47; Billing 29 → 41; Support 55 → 61; Mobile 33 → 44
NPS by product area, 2025 to 2026, data table
name20252026
Onboarding4258
Dashboards5149
Exports3847
Billing2941
Support5561
Mobile3344
  • Takes one row per item with an index field naming it, and the series as columns: two periods, many periods (bump) or axes. You choose whether the highest value is rank 1 and give one colour per row.

  • data-slot="chart-plot"

    The focusable region. Arrow keys walk its marks and a live region reads each one the way the tooltip shows it.

  • data-slot="chart-marks"

    A line (or dumbbell) per item, drawn along its path with the name and value at each end. Rank variants turn values into ranks per column and join them with smooth curves.

  • The series labels above the columns, or beneath a dumbbell's value axis.

  • data-slot="chart-tooltip"Optional

    The item name with its value in every column and, on rank variants, its rank.

  • data-slot="chart-message"Optional

    Muted bars under the shimmer, then the empty message when the data has no rows.

  • A hidden table with the items as rows and the columns as series.

Best practices

  • Do

    Keep to about ten items. Names are printed at both ends and more than ten overlap.

  • Do

    Highlight one or two items with colour and keep the rest neutral. A slope chart with ten bright lines has no focus.

  • Do

    Set the rank order to ascending when the values are already ranks, where 1 is the best.

  • Don’t

    Don't use it for items with very different magnitudes, because the steepest line is the largest value, not the biggest change. Use a rank shift or index the values to 100.

  • Don’t

    Don't use parallel coordinates for fewer than three axes. A slope chart does the same with less to learn.

API reference

One table for SlopeChart, listing every prop. The ChartCard around it has its own props, and the chart also works without one.

Takes one row per item with an index field naming it, and the series as columns: two periods, many periods (bump) or axes. You choose whether the highest value is rank 1 and give one colour per row.

PropTypeDefaultDescription
data requiredreadonly ChartDatum[]—One row per item (team, product …).
index requiredstring—Field holding the item's name.
series requiredreadonly ChartSeries[]—The columns: two periods (slope, rank shift, dumbbell), many periods (bump) or the axes (parallel coordinates).
variant"slope-chart" | "rank-shift" | "bump-chart" | "dumbbell" | "parallel-coordinates""slope-chart"Figma variant. Default .
rankOrder"desc" | "asc""desc"Rank order of and : highest value = #1 (, default) or lowest (, e.g. when the values are ranks already).
colorsreadonly ChartColor[]—Colours per row (slope, rank, bump, parallel). Default: palette order.
valueFormatterChartValueFormatter—
labelstring—
heightnumber—
state"ready" | "loading" | "empty" | "error"—
hiddenSeriesreadonly string[]—Row names (or, for the dumbbell, series keys) switched off in the legend.
activeIndexnumber | null—The active point (hovered or focused) as an index into , to control it yourself. shows none.
animateboolean—
animationKeystring | number—
defaultActiveIndexnumber | null—The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer.
descriptionstring—
onActiveIndexChange(index) => void—Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline.
onRetry() => void—Shows a Try again button in the error state and calls this when it is pressed.
widthnumber—

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("slope-chart")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.