SlopeGraph
Charts

SlopeGraph

One line per series connecting two points in time, showing which series rose, fell, or crossed between a before and an after.

Component behavior

SlopeGraph compares two values per series with connected endpoints. Column labels identify the two periods. The chart does not display intermediate values.

Use cases
  • Series compared across exactly two time points.
  • Changes in value or rank between endpoints.
  • Two-point comparisons with direct series labels.
Alternatives

LineChart: three or more time points must be traced.

BarChart: absolute magnitudes are the main comparison.

SankeyDiagram: flows split or merge between endpoints.

Props

Each SlopeSeries has a label and its start and end values. Both endpoints share one scale, so the slope angle is a true encoding of the change. Colors fall back to the shared palette; the column headers are set by startLabel and endLabel.

SlopeGraphProps props
PropTypeDefaultDescription
seriesSlopeSeries[]—One line per series: label, start value, end value, and an optional color. Labels are used as React keys.
startLabelReactNode—Column header over the left (start) time point.
endLabelReactNode—Column header over the right (end) time point.
widthnumber360Layout width in pixels; the chart scales to its container.
heightnumber300Layout height in pixels.
minnumber—Pin the bottom of the shared value domain. Defaults to the data extent, padded.
maxnumber—Pin the top of the shared value domain. Defaults to the data extent, padded.
formatValue(value: number) => string—Formats the endpoint values printed beside each series.

Examples

NPS by plan

SlopeGraph
ImportTSX
import { SlopeGraph } from "@solarius/onset";
import type { SlopeSeries } from "@solarius/onset";