Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Slope Chart

ProNew

How a set of measures moved between two moments, labelled at both ends with leaders where labels are moved apart, drawn one line after another.

Installation

pnpm dlx shadcn@latest add @viewport/slope-chart

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
title*string—
fromLabel*string

The names of the two columns, e.g. two versions or two dates.

—
toLabel*string—
items*SlopeItem[]—
format(value: number) => string(value) => `${value}%`
captionReact.ReactNode

A line under the chart.

—
heightnumber

The height of the plot, in pixels.

400
classNamestring—

Accessibility

  • Named as an image that states every measure's old and new value.
  • Names stay on one side on narrow containers so the lines keep their room.
  • Hover isolates one line; nothing depends on hover to be read.
  • Lines appear already drawn under reduced motion.