Skip to content
ChartslibraryUI Get Pro

Variance chart

Actual vs plan per line item: levels and variance side by side, coloured by business direction.

When to use

  • Budget vs actual by cost centre
  • Revenue and cost lines vs plan
  • Monthly business reviews

When not to use

Good practice

  • Pass favorable={{ key }} when a table mixes income and cost lines.
  • Keep P&L order unless sorting by variance helps the story.

Installation

Variance chart is a Pro chart.

Installation is part of Pro

The full source is included in the Pro download. Get Pro to install it with the CLI and use it in unlimited projects.

Unlock with Pro
Already have Pro?npx chartslibraryui add variance-chart --from ./chartslibraryui-pro

Usage

Usage examples are part of Pro

Every example on this page comes with its code in the Pro download. The props and data shape below are public.

Unlock with Pro

Data

Rows with a label key, an actual key and a plan key; optional per-row favorable key.

[{ category: "Travel", amount: 22100, budget: 30000 }, ...]

Missing values are null. Invalid values make the chart say what’s wrong instead of drawing a misleading picture. How charts handle bad data

Props

Every chart also accepts the shared frame props: title, subtitle, source, height, mode, toolbar. Common API

export interface VarianceChartProps extends FrameProps {
  data: Row[];
  /** Key of the line item / market label. */
  x: string;
  actual: string;
  /** Plan, budget, forecast or prior period. */
  plan: string;
  format?: FormatInput;
  /** Is above plan good? Default "up". Can be a key in each row ("up"/"down"), for mixed revenue and cost lines. */
  favorable?: Favorable | { key: string };
  actualLabel?: string;
  planLabel?: string;
  /** Sort by absolute variance. Default false (keep the data order, e.g. P&L order). */
  sortByVariance?: boolean;
}
Pro

Waterfall chart

A bridge from one total to another, with computed subtotals that always close.

Diverging bar chart

Positive and negative changes either side of zero, coloured by business direction.