Skip to content
ChartslibraryUI Get Pro

Cohort heatmap

Retention by cohort with incomplete cohorts left blank and a size-weighted average.

When to use

  • Customer or logo retention
  • Revenue retention (values above 100% allowed)
  • Payback curves by cohort

When not to use

Good practice

  • Use null for periods not yet observed, never 0.
  • Pass size so the average is weighted correctly.

Installation

Cohort heatmap 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 cohort-heatmap --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

An array of cohorts: { cohort, size, values[] } where values are fractions of the starting cohort.

[{ cohort: "Jan 26", size: 340, values: [1, 0.78, 0.72, null] }]

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 CohortHeatmapProps extends FrameProps {
  data: Cohort[];
  /** Default: percent (retention as a fraction of the starting cohort). */
  format?: FormatInput;
  /** Column label prefix. Default "M" (M0, M1, ...). */
  periodPrefix?: string;
  sizeLabel?: string;
  /** Show a size-weighted average row. Default true. */
  average?: boolean;
}
Pro

Heatmap

A grid coloured by value, sequential or diverging, with missing cells hatched.

Line chart

Trends over time for one to four series, with gaps for missing data and marked forecasts.