# ChartslibraryUI > React chart components for finance, SaaS and analytics dashboards. One file each, no chart library underneath, honest with messy data. 26 free and MIT, Pro is a one-time purchase. 47 components: 26 free (MIT) and 21 Pro (one-time license). Charts install as source files into components/charts/ and need React 18+ only. Import components/charts/core/charts.css once. Conventions: data is an array of row objects plus the keys to read; null = missing (drawn as a gap, never 0); percent values are fractions (0.12 = 12%); favorable="down" for costs/churn/latency; no dual axes (use ComboChart, IndexChart or SmallMultiples); bars always start at zero. ## Docs - [Introduction](https://chartslibraryui.com/docs) - [Installation](https://chartslibraryui.com/docs/installation) - [CLI](https://chartslibraryui.com/docs/cli) - [Free vs Pro](https://chartslibraryui.com/docs/free-vs-pro) - [Choosing a chart](https://chartslibraryui.com/docs/choosing-a-chart) - [Common API](https://chartslibraryui.com/docs/api) - [Number formatting](https://chartslibraryui.com/docs/formatting) - [Data and edge cases](https://chartslibraryui.com/docs/data-and-edge-cases) - [Theming](https://chartslibraryui.com/docs/theming) - [Accessibility](https://chartslibraryui.com/docs/accessibility) - [Customization](https://chartslibraryui.com/docs/customization) - [Composition](https://chartslibraryui.com/docs/composition) - [Using with AI agents](https://chartslibraryui.com/docs/ai-agents) - [Troubleshooting](https://chartslibraryui.com/docs/troubleshooting) - [Full context in one file](https://chartslibraryui.com/llms-full.txt) - [Structured catalogue (JSON)](https://chartslibraryui.com/charts.json) ## Trend - [LineChart](https://chartslibraryui.com/charts/line-chart) (free): Trends over time for one to four series, with gaps for missing data and marked forecasts. - [AreaChart](https://chartslibraryui.com/charts/area-chart) (free): A line with a light wash to zero, for volume over time. - [StackedAreaChart](https://chartslibraryui.com/charts/stacked-area-chart) (free): A total over time and what it's made of, in absolute terms or as 100% shares. - [StepLineChart](https://chartslibraryui.com/charts/step-line-chart) (free): Values that change on a date and hold: prices, rates, headcount. - [IndexChart](https://chartslibraryui.com/charts/index-chart) (free): Measures in different units rebased to 100, so growth compares on one honest axis. - [Sparkline](https://chartslibraryui.com/charts/sparkline) (free): A word-sized trend for tiles, tables and inline text. - [SmallMultiples](https://chartslibraryui.com/charts/small-multiples) (free): One small chart per group on a shared scale, instead of a ten-colour spaghetti chart. - [CandlestickChart](https://chartslibraryui.com/charts/candlestick-chart) (pro): OHLC prices with volume in its own panel and malformed rows rejected. ## Comparison - [BarChart](https://chartslibraryui.com/charts/bar-chart) (free): Columns for one measure across periods or categories, always from zero. - [HorizontalBarChart](https://chartslibraryui.com/charts/horizontal-bar-chart) (free): Ranked bars with readable labels, the default for comparing items. - [GroupedBarChart](https://chartslibraryui.com/charts/grouped-bar-chart) (free): Two to four measures side by side per category. - [StackedBarChart](https://chartslibraryui.com/charts/stacked-bar-chart) (free): Totals and their parts, with negatives stacked below zero. - [DivergingBarChart](https://chartslibraryui.com/charts/diverging-bar-chart) (free): Positive and negative changes either side of zero, coloured by business direction. - [DotPlot](https://chartslibraryui.com/charts/dot-plot) (free): Many items on one scale, optionally against a comparison, with no zero required. - [SlopeChart](https://chartslibraryui.com/charts/slope-chart) (free): Two points in time per item, where both change and rank matter. - [ParetoChart](https://chartslibraryui.com/charts/pareto-chart) (pro): How concentrated a total is: sorted shares and the cumulative curve on one axis. - [DumbbellChart](https://chartslibraryui.com/charts/dumbbell-chart) (pro): Before and after per item with the change printed and coloured by direction. ## Composition - [DonutChart](https://chartslibraryui.com/charts/donut-chart) (free): One whole in up to six parts, with the total in the middle and a value legend. - [PieChart](https://chartslibraryui.com/charts/pie-chart) (free): Two to five parts of one whole, with a value-and-share legend. - [Treemap](https://chartslibraryui.com/charts/treemap) (free): Many parts of one whole, sized by area and optionally grouped. - [WaffleChart](https://chartslibraryui.com/charts/waffle-chart) (free): A countable part-to-whole: one square is one percent. - [MixShiftChart](https://chartslibraryui.com/charts/mix-shift-chart) (pro): 100% columns joined by bands, showing how a mix changes across periods. ## Distribution - [ScatterChart](https://chartslibraryui.com/charts/scatter-chart) (free): The relationship between two measures, with groups, bubbles, quadrants and a trend line. - [Histogram](https://chartslibraryui.com/charts/histogram) (free): The shape of one distribution, with automatic binning and a median marker. - [StripPlot](https://chartslibraryui.com/charts/strip-plot) (free): Every observation visible by group, with the median marked. - [BoxPlot](https://chartslibraryui.com/charts/box-plot) (pro): Median, quartiles, whiskers and every outlier per group, with n printed. ## KPIs & tables - [KpiTile](https://chartslibraryui.com/charts/kpi-tile) (free): A headline number with its comparison, direction-aware colour and an optional sparkline. - [KpiRow](https://chartslibraryui.com/charts/kpi-row) (free): A responsive row of KPI tiles that wraps cleanly. - [TargetBarChart](https://chartslibraryui.com/charts/target-bar-chart) (free): Progress against a target per item: bar, target tick and attainment in words. - [ComboChart](https://chartslibraryui.com/charts/combo-chart) (free): Two measures in different units on stacked panels sharing one x axis: never a dual axis. - [TableChart](https://chartslibraryui.com/charts/table-chart) (free): A sortable table with inline bars, coloured deltas and sparklines. - [BulletChart](https://chartslibraryui.com/charts/bullet-chart) (pro): KPIs against targets and qualitative ranges: the compact replacement for gauges. ## Finance & variance - [WaterfallChart](https://chartslibraryui.com/charts/waterfall-chart) (pro): A bridge from one total to another, with computed subtotals that always close. - [VarianceChart](https://chartslibraryui.com/charts/variance-chart) (pro): Actual vs plan per line item: levels and variance side by side, coloured by business direction. - [VarianceTrendChart](https://chartslibraryui.com/charts/variance-trend-chart) (pro): Variance to plan by period, split into drivers either side of zero with the net marked. - [FootballFieldChart](https://chartslibraryui.com/charts/football-field-chart) (pro): Valuation or scenario ranges by method against reference prices. ## Forecasting - [ActualVsForecastChart](https://chartslibraryui.com/charts/actual-vs-forecast-chart) (pro): Actuals solid, forecast dashed from the last actual, plan line and uncertainty band. - [FanChart](https://chartslibraryui.com/charts/fan-chart) (pro): A forecast with nested uncertainty intervals that widen with the horizon. - [PacingChart](https://chartslibraryui.com/charts/pacing-chart) (pro): Cumulative month-to-date actual against plan with a run-rate projection. ## Grids & calendars - [Heatmap](https://chartslibraryui.com/charts/heatmap) (pro): A grid coloured by value, sequential or diverging, with missing cells hatched. - [CohortHeatmap](https://chartslibraryui.com/charts/cohort-heatmap) (pro): Retention by cohort with incomplete cohorts left blank and a size-weighted average. - [CalendarHeatmap](https://chartslibraryui.com/charts/calendar-heatmap) (pro): A year of daily values as weeks × weekdays. ## Flows & funnels - [FunnelChart](https://chartslibraryui.com/charts/funnel-chart) (pro): Nested stages with step and overall conversion printed. - [SankeyChart](https://chartslibraryui.com/charts/sankey-chart) (pro): Conserved flows between stages, with cycle checks and in/out balance warnings. ## Dashboard blocks - [BudgetVsActualBoard](https://chartslibraryui.com/charts/budget-vs-actual-board) (pro): KPIs, cumulative spend vs budget and variance by category in one block. - [SaasMetricsBoard](https://chartslibraryui.com/charts/saas-metrics-board) (pro): ARR, NRR, churn tiles; MRR vs plan; MRR movements; cohort retention. - [PnlSummary](https://chartslibraryui.com/charts/pnl-summary) (pro): A generic income statement table with variances plus a walk to the bottom line. --- # Introduction ChartslibraryUI is a collection of React chart components for analytical products: dashboards, financial tools, SaaS admin panels and internal reporting. You don't install it as a package. Each chart is a TypeScript file that you add to your project, either with a CLI or by copying it. After that the code is yours: change colours, tooltips, formatting or behaviour directly in your repository. ## What you get - **47 charts and blocks.** 26 are free (MIT); 21 are in [Pro](/docs/free-vs-pro). - **A small shared core** (`core/`): scales, path builders, number formatting, the chart frame (title, legend, tooltip, table view, CSV), data checks and the theme. Every chart uses it. - **No runtime dependencies** beyond React 18 or 19. Charts are hand-written SVG. - **Light and dark** from one CSS file of variables. - **Guidance with every chart:** what it's for, when to avoid it, and what to use instead. It's written for both developers and coding agents. ## Principles 1. **Honest by default.** Bars start at zero. There are no dual axes. Missing values are gaps, never interpolated. Forecasts and partial periods are visibly marked. Invalid data produces a message on the chart, not a misleading picture. See [Data and edge cases](/docs/data-and-edge-cases). 2. **Beautiful without configuration.** A restrained palette, hairline grids, direct labels where they help, and a single crosshair tooltip. 3. **Readable source.** No plugin system and no configuration DSL. Props map to what you see. 4. **Accessible.** Every chart has a screen-reader summary, keyboard navigation and a table view. ## Next steps - [Install](/docs/installation) a chart in two minutes. - [Choose a chart](/docs/choosing-a-chart) by the question you're answering. - Learn the [common API](/docs/api) shared by every chart. --- # Installation Charts install as source files into one folder of your project (by default `components/charts/`). Every chart needs the shared `core/` folder next to it, and all three methods below take care of that. **Requirements:** React 18 or 19 and TypeScript (recommended; the files are `.tsx`). There's no Tailwind requirement and no other runtime dependency. ## Option 1: shadcn CLI If your project is already set up for [shadcn/ui](https://ui.shadcn.com) (it has a `components.json`): ```bash npx shadcn@latest add https://chartslibraryui.com/r/line-chart.json ``` This writes `components/charts/line-chart.tsx` and `components/charts/core/*`. Add more charts the same way; shared files are reused. ## Option 2: the chartslibraryui CLI A small zero-dependency CLI that works in any project: ```bash npx chartslibraryui add line-chart bar-chart ``` Use `--dir` to choose another folder (for example `--dir src/components/charts`). See [CLI](/docs/cli) for every command. ## Option 3: copy and paste 1. Copy the `core/` folder into `components/charts/core/`. 2. Copy the chart file (for example `line-chart.tsx`) into `components/charts/`. 3. Some charts build on others (`pie-chart` uses `donut-chart`). The chart page lists those files under **Source**. ## Import the theme once Charts are styled by one CSS file. Import it once, in your root layout or entry file: ```tsx // app/layout.tsx (Next.js App Router), or src/main.tsx (Vite) import "@/components/charts/core/charts.css"; ``` ## Use a chart ```tsx import { LineChart } from "@/components/charts/line-chart"; const rows = [ { month: "Jan", revenue: 1_820_000, plan: 1_800_000 }, { month: "Feb", revenue: 1_910_000, plan: 1_860_000 }, { month: "Mar", revenue: null, plan: 1_920_000 }, // missing: drawn as a gap ]; export function Revenue() { return ( ); } ``` Charts are client components (they measure their container and handle pointer events). In the Next.js App Router they already start with `"use client"`, so you can render them from server components. ## Import aliases The examples use `@/components/charts/...`. If your project uses another alias or `src/`, adjust the import path. Inside the charts, imports are relative (`./core/frame`), so the folder can live anywhere. ## Pro charts Pro charts come as a download that contains the same folder layout and a local registry. Install them with the CLI pointed at the download: ```bash npx chartslibraryui add waterfall-chart --from ./chartslibraryui-pro ``` No account and no network access are needed. See [Free vs Pro](/docs/free-vs-pro). --- # CLI `chartslibraryui` is a single-file Node CLI with no dependencies. It reads registry JSON from the website, from a URL, or from a local folder (the Pro download), resolves dependencies and writes source files into your project. Requires Node 18 or later. ## Commands ### add ```bash npx chartslibraryui add [options] ``` Installs one or more charts, the charts they depend on, and the shared `core/`. | Option | Default | Meaning | |---|---|---| | `--dir ` | `components/charts` | Where files are written. Use `src/components/charts` in `src/` projects. | | `--from ` | the public registry | A registry folder or base URL. Point it at your Pro download to install Pro charts. | | `--overwrite` | off | Replace files that already exist. Without it, existing files are kept (your edits are safe). | | `--dry-run` | off | List what would be written without writing. | ```bash # free charts from the public registry npx chartslibraryui add line-chart donut-chart # Pro charts from your download folder npx chartslibraryui add waterfall-chart cohort-heatmap --from ./chartslibraryui-pro # a custom folder npx chartslibraryui add bar-chart --dir src/ui/charts ``` ### list ```bash npx chartslibraryui list [--from ] ``` Lists the available charts with tier and description. Use `--from` to list your Pro download. ### info ```bash npx chartslibraryui info waterfall-chart [--from ] ``` Shows the description, the files a chart installs and its dependencies. ## How it decides what to write Each chart's registry entry lists its files and its dependencies (`registryDependencies`). The CLI resolves them recursively, writes each file once, and skips files that already exist unless you pass `--overwrite`. So if you've customised `core/format.ts`, adding another chart won't undo your change. ## Updating a chart Charts are your code, so updates are deliberate. To take a newer version of a chart, run `add` with `--overwrite` on a clean git working tree and review the diff. ## Without Node Every chart page has a **Source** section with the full file, and `/r/.json` holds the same files as JSON. You can always copy by hand. --- # Free vs Pro ## Free (MIT) The everyday charts and the entire shared core, free for commercial use, with no attribution required. Trend: line, area, stacked area, step line, index, sparkline, small multiples. Comparison: bar, horizontal bar, grouped bar, stacked bar, diverging bar, dot plot, slope. Composition: donut, pie, treemap, waffle. Distribution: scatter, histogram, strip plot. KPIs and tables: KPI tile, KPI row, target bar, combo, table chart. ## Pro (one-time purchase) The analytical and financial charts that take the longest to get right, plus ready-made dashboard blocks: - **Finance and variance:** waterfall (computed subtotals), variance chart (per-line favorable direction), variance trend by driver, bullet, football field, Pareto - **Forecasting:** actual vs forecast, fan chart, pacing - **Grids:** heatmap (sequential and diverging), cohort retention heatmap, calendar heatmap - **Markets and distributions:** candlestick with volume, box plot, dumbbell - **Flows:** funnel, sankey (with balance checks), mix shift - **Dashboard blocks:** budget vs actual board, SaaS metrics board, P&L summary See the [pricing page](/pricing) for the current price and the [license](/license) for terms. ## How Pro is delivered 1. Buy through the checkout link on the pricing page. 2. Download `chartslibraryui-pro-.zip`. It contains: - `charts/`: every chart's source (free and Pro) with `core/` - `r/`: a local registry for the CLI - `examples/`: the usage examples from this site - `LICENSE-PRO.md` and `README.md` 3. Unzip it next to your project and install: ```bash npx chartslibraryui add waterfall-chart --from ./chartslibraryui-pro ``` The CLI reads the local folder. There's no license key, no account and no network call. Commit the installed files like any other source. ## Same core, mixed freely Free and Pro charts share `core/`, so you can install them in any order into the same folder. --- # Choosing a chart Start from the question you're answering, not the chart type. The table below maps common questions to a chart; the full index after it is generated from each chart's own guidance. | Question | Use | Not | |---|---|---| | How did one metric change over time? | [Line](/charts/line-chart), [Area](/charts/area-chart) | Bars for 30+ periods | | Are we on track against plan? | [Actual vs forecast](/charts/actual-vs-forecast-chart), [Pacing](/charts/pacing-chart), [Bullet](/charts/bullet-chart) | A gauge | | What drove the change from A to B? | [Waterfall](/charts/waterfall-chart) | Stacked bars | | Which items are over or under budget? | [Variance](/charts/variance-chart), [Diverging bar](/charts/diverging-bar-chart) | Two grouped bars per item | | Which is biggest? | [Horizontal bar](/charts/horizontal-bar-chart) | Pie with 9 slices | | What is the total made of? | [Stacked area](/charts/stacked-area-chart), [Stacked bar](/charts/stacked-bar-chart), [Donut](/charts/donut-chart) (≤ 6 parts) | 3D pie | | How has the mix shifted? | [Mix shift](/charts/mix-shift-chart), [100% stacked area](/charts/stacked-area-chart) | Several pies | | Two measures in different units? | [Combo](/charts/combo-chart), [Index](/charts/index-chart) | A dual axis | | Same metric across many groups? | [Small multiples](/charts/small-multiples) | A 10-line spaghetti chart | | How are values distributed? | [Histogram](/charts/histogram), [Box plot](/charts/box-plot), [Strip plot](/charts/strip-plot) | An average alone | | Do two measures move together? | [Scatter](/charts/scatter-chart) | Two lines | | Before vs after, per item? | [Dumbbell](/charts/dumbbell-chart), [Slope](/charts/slope-chart) | Grouped bars | | Do customers stay? | [Cohort heatmap](/charts/cohort-heatmap) | A single churn rate | | Where do people drop off? | [Funnel](/charts/funnel-chart) | Pie | | Where does the money go? | [Sankey](/charts/sankey-chart), [Treemap](/charts/treemap) | Nested donuts | | What happens by day or hour? | [Calendar heatmap](/charts/calendar-heatmap), [Heatmap](/charts/heatmap) | 365 bars | | The headline number? | [KPI tile](/charts/kpi-tile), [KPI row](/charts/kpi-row) | A chart | ## Rules of thumb - **Not every number needs a chart.** One number plus its comparison is a [KPI tile](/charts/kpi-tile). - **Lengths beat angles beat areas.** Prefer bars to pies and pies to treemaps when precision matters. - **Past four series, facet.** Small multiples beat colour-matching against a legend. - **Two units, two panels.** Never two y-axes on one plot. --- # Common API All charts follow the same conventions, so learning one teaches you the rest. ## Data Charts take **an array of plain row objects** and **the keys to read**. You don't reshape your data into a chart-specific format. ```tsx ``` - `series` accepts strings or `{ key, label?, color?, dashed? }`. - Single-measure charts use `y` (plus an optional `label`). - `null` or `undefined` means **missing**. It's drawn as a gap or left out, and a note says how many. - Strings where numbers are expected are **invalid**. The chart shows an error naming the rows instead of guessing. ## Frame props (every chart) | Prop | Type | Meaning | |---|---|---| | `title` | ReactNode | The takeaway: "Revenue passed plan in March" | | `subtitle` | ReactNode | What's measured: metric, unit, period | | `source` | ReactNode | Shown in the footer as "Source: …" | | `footnote` | ReactNode | Extra footer text | | `height` | number | Plot height in px (horizontal bar charts grow with rows by default) | | `width` | number | Fixed width; by default the chart fills its container | | `mode` | `"light" \| "dark" \| "auto"` | Override the inherited theme | | `toolbar` | boolean | Show the Table/CSV buttons (default `true`) | | `showNotes` | boolean | Show data notes under the chart (default `true`) | | `titleAs` | `"h2" \| "h3" \| "h4" \| "div"` | Heading level of the title (default `h3`) | | `className`, `style` | | Applied to the outer `
` | ## Shared value props | Prop | Charts | Meaning | |---|---|---| | `format` | all | See [formatting](/docs/formatting) | | `highlight` | line, bar, donut, scatter, slope… | Keys or labels to emphasise; others turn grey | | `favorable` | diverging, variance, waterfall, KPI… | `"up"` (default) or `"down"`: which direction is good | | `forecastFrom` | line family, bars | First x value that is a forecast | | `partialFrom` | line family, bars | First x value that is incomplete | | `references` | line family, bars | `[{ value, label }]` reference lines | | `zero` | line, scatter, dot plot | Include zero in the axis (bars and areas always do) | | `sort` | bar, dot, dumbbell | `"none" \| "asc" \| "desc"` | ## Interaction built in - **Tooltip:** a crosshair on time series, and per mark everywhere else. It lists every series with the same formatting as the axis. - **Keyboard:** tab to a chart, then use arrow keys to move through points or categories, Home/End to jump, and Escape to clear. - **Legend:** click to hide or show a series; hover to highlight it. - **Table view and CSV:** the toolbar switches the chart to an accessible table and downloads the underlying data. ## Charts that report problems Each chart validates its data: | Situation | Result | |---|---| | Empty data | "No data to display" placeholder | | Non-numeric values | Error listing the key and sample values | | Impossible input (negative pie slice, high < low in OHLC, cyclic sankey) | Error naming the rows | | Missing values | Gaps, plus a note with the count | | Duplicates, too many series, inconsistent subtotals | A "Check:" warning under the chart | | A render crash | Caught by the chart's error boundary and shown as a message, so the page keeps working | Set `showNotes={false}` to hide notes and warnings (errors always show). ## Core exports Building something custom? The core is importable: ```ts import { ChartFrame, ChartTooltip, useActiveIndex } from "@/components/charts/core/frame"; import { linearScale, bandScale, valueDomain, niceTicks, timeTicks } from "@/components/charts/core/scale"; import { linePath, areaPath, barPath, arcPath } from "@/components/charts/core/path"; import { formatValue, tickFormatter } from "@/components/charts/core/format"; import { checkRows, column, parseDate } from "@/components/charts/core/data"; import { YGrid, XLabels, RefLine, PeriodShade } from "@/components/charts/core/axis"; ``` See [Composition](/docs/composition) for a worked example. --- # Number formatting Every chart takes a `format` prop. The same format drives the axis, tooltips, labels, legends, the table view and KPI tiles, so a value is written the same way everywhere. ## Presets | `format` | 1234567 | 0.1234 | −5000 | |---|---|---|---| | `"number"` (default) | 1.2M | 0.12 | −5,000 | | `"integer"` | 1.2M | 0 | −5,000 | | `"currency"` | $1.2M | $0.12 | −$5,000 | | `"percent"` | – | 12.3% | – | | `"pp"` (percentage points) | – | +0.1 pp | – | | `"compact"` | 1.2M | 0.12 | −5.0K | | `"currency-compact"` | $1.2M | $0.12 | −$5.0K | Compact notation (1.2K, 4.2M, 1.3B) starts at **10,000** in labels, axes and tooltips. Below that, numbers are written in full (1,284). Tables always show full values. ## Spec objects For control, pass an object: ```ts format={{ kind: "currency", currency: "EUR", decimals: 0, locale: "de-DE" }} format={{ kind: "percent", decimals: 1 }} // 0.125 → 12.5% format={{ kind: "number", unit: "ms" }} // 184 → 184 ms format={{ kind: "number", decimals: 1, signed: true }} // 2.3 → +2.3 format={{ kind: "currency", unit: "m" }} // values already in millions ``` | Field | Meaning | |---|---| | `kind` | `number`, `integer`, `currency`, `percent`, `pp` | | `compact` | `"auto"` (default), `true` (always), `false` (never) | | `decimals` | Fixed decimals. Otherwise chosen per context. | | `currency` | ISO 4217 code, default `USD` | | `unit` | Text after the number: `"ms"`, `"trips"`, `"x"` | | `signed` | Always show `+` for positive values | | `locale` | BCP 47 locale, default `en-US` | Or pass a function: `format={(v) => `${v.toFixed(1)}°C`}`. ## Rules the formatter enforces - **Percent values are fractions.** Pass `0.125` for 12.5%. Differences between percentages are written in **percentage points** (`+2.1 pp`), not as a percent of a percent. - **Magnitude units are never re-compacted.** With `unit: "m"` (values already in millions), 1000 is written `$1,000m`, never `$1.0Km`. The same applies to `k`, `bn`, `M`, `B`. - **Zero is written plainly:** `0`, `$0`, `0%`, never `$0.0M`. - **Tiny values don't collapse to zero:** 0.00012 is written `0.00012`, not `0.00`. - **Missing values are an en dash** (–), never `0`. - **Negative numbers use a true minus sign** (−). - **One magnitude per axis:** ticks share a suffix and the fewest decimals that keep them distinct (`0`, `$5K`, `$10K`, `$15K`). - **Shares under 0.5% read `<1%`** in donuts and treemaps rather than a misleading `0%`. ## Dates Category axes show your labels as given. With `xType="time"`, values can be ISO strings (`"2026-03-01"`), `Date` objects or epoch milliseconds. **Date-only strings are read as UTC midnight**, so a date never shifts a day in a timezone west of UTC. Tick labels are calendar-aligned (days, weeks, months, quarters, years) based on the span. ## Using the formatter yourself The helpers are exported from `core/format.ts`: ```ts import { formatValue, formatDelta, formatChange, formatShare } from "@/components/charts/core/format"; formatValue(18_420_000, "currency"); // "$18.4M" formatValue(18_420_000, "currency", { context: "table" }); // "$18,420,000" formatDelta(0.024, "percent"); // "+2.4 pp" formatChange(18.42, 15.96); // "+15.4%" formatShare(0.004); // "<1%" ``` --- # Data and edge cases Production data is messy, and a chart that quietly hides that is worse than no chart. These are the rules every chart follows. ## Missing values `null`, `undefined` and `NaN` mean **missing**. - **Lines and areas** break at missing values. They're never interpolated. A point with no neighbours is drawn as a dot so it doesn't disappear. - **Stacked areas** leave the whole column empty if any layer is missing there, because a total with a hole in it is wrong. - **Bars** draw nothing for a missing value. Zero is drawn as zero. - **Heatmaps** hatch missing cells and the tooltip says "No data". Missing is never coloured as zero. - **Cohorts** leave unobserved cells blank, and averages only use observed cells. A note under the chart says how many values are missing. ## Invalid values A string, object or boolean where a number is expected is **invalid**. The chart doesn't guess (`"12"` is not silently converted). It shows *"This chart can't be drawn"* with the key and sample values, so the bug is visible in development. ## Impossible data | Chart | Rejected | Why | |---|---|---| | Donut, pie, treemap, waffle | Negative values | A share of a whole can't be negative | | Stacked area, 100% bars, mix shift | Negative values | They can't be stacked honestly | | Candlestick | `high < max(open, close)` or `low > min(open, close)` | Malformed OHLC rows are listed by date | | Football field | `low > high` | The range would be inverted | | Sankey | Cycles, self-links, negative flows | Flows must go one way | | Forecast bands | `lower > upper` | The interval would be inverted | | Index chart | Zero or missing base value | You can't divide by it | ## Suspicious data (warnings) Warnings appear as **"Check: …"** under the chart: - Duplicate x values (two rows for "Mar"). Each is drawn, and you're told to aggregate. - More series than colours (the extras are grey). - Waterfall subtotals that don't match their steps. The computed value is shown, along with what was given. - Sankey nodes whose inflow and outflow don't balance. - Funnel stages that grow. - Very small samples in histograms and box plots. ## Forecasts and partial periods - `forecastFrom` dashes forecast segments, shades the forecast region and labels it "Forecast". Tooltips say "Forecast". - `partialFrom` marks incomplete periods (month to date): faded bars, a shaded region, and "Partial period" in tooltips. - The Pro `ActualVsForecastChart` takes actual and forecast as **separate keys** and joins them at the last actual, so the two can't be confused. ## Axes - Bars, columns and areas **always include zero**. - Lines, dot plots and scatter plots may start elsewhere (`zero={false}`), because position, not length, encodes the value. - No chart has two y-axes. Use `ComboChart` (two aligned panels), `IndexChart` (rebased to 100) or `SmallMultiples`. - Outliers are never clipped. If one point compresses everything else, consider a log transform in your data and say so in the subtitle. ## Extreme values - Very large numbers compact (`$4.2B`). Very small non-zero numbers keep two significant digits instead of rounding to `0`. - Series of very different magnitudes on one axis are a design problem, not a rendering one. Use small multiples or an index chart. - Large datasets: lines handle tens of thousands of points, and scatter plots stay responsive to a few thousand (smaller dots, no outlines above 400 points). ## Dates With `xType="time"`, date-only ISO strings are read as **UTC** (`"2026-03-01"` is March 1 everywhere). Rows are sorted by date. Irregular intervals are spaced in real time, and unreadable dates produce an error naming how many rows failed. --- # Theming All chart colours, inks and surfaces are CSS variables defined in `core/charts.css`. Charts reference roles (`var(--clui-s1)`, `var(--clui-grid)`), never raw colours, so re-theming is a CSS change. ## Dark mode Charts switch to dark tokens when any ancestor has: - the class `dark` (Tailwind, shadcn/ui, next-themes with `attribute="class"`), or - `data-theme="dark"` (next-themes with `attribute="data-theme"`). You can also force a mode per chart or per region: ```tsx // this chart only // follow prefers-color-scheme
…
// everything inside is light, even on a dark page
…
// everything inside is dark ``` Dark mode is not an automatic inversion. Every colour has a separately chosen dark step, checked against the dark surface. ## Re-branding Override variables on `.clui` (or on a scope class) after importing `charts.css`: ```css .clui { --clui-font: "Inter", system-ui, sans-serif; --clui-s1: #5b4cf0; /* accent / first series */ --clui-surface: #fcfcfb; /* chart background */ } .dark .clui { --clui-s1: #8b80f5; --clui-surface: #141414; } ``` ## Token reference | Token | Role | |---|---| | `--clui-font` | Font family (default `inherit`: your app's font) | | `--clui-surface` | Chart background; also the gap colour between touching marks | | `--clui-ink`, `--clui-ink-2`, `--clui-ink-3` | Primary, secondary and muted text | | `--clui-grid`, `--clui-axis` | Gridlines; zero line and axis ticks | | `--clui-s1` … `--clui-s8` | Categorical series colours, in fixed order | | `--clui-s1-ink` … `--clui-s8-ink` | Text colour for labels placed inside a series fill | | `--clui-context`, `--clui-context-soft` | Grey for context series and "Other" | | `--clui-good`, `--clui-bad`, `--clui-neutral` | Favorable / unfavorable / no-change marks | | `--clui-good-text`, `--clui-bad-text` | Text versions (higher contrast) | | `--clui-total` | Totals in waterfalls, nodes in sankeys | | `--clui-forecast-bg`, `--clui-partial-bg` | Shading for forecast and partial periods | | `--clui-seq-1` … `--clui-seq-7` | Sequential ramp (heatmaps), with matching `-ink` tokens | | `--clui-div-n3` … `--clui-div-p3` | Diverging ramp around a neutral grey `--clui-div-0` | ## Colour rules - **Categorical colours are assigned in order and never cycled.** The ninth series is grey and the chart adds a note. Use [small multiples](/charts/small-multiples) or group into "Other". - **Colour follows the series, not its rank or visibility.** Hiding a series from the legend never repaints the others. - **Emphasis by default:** pass `highlight` to colour one or two series and draw the rest in grey context. - **Good and bad follow `favorable`, not the sign.** A fall in cost is favorable when `favorable="down"`. - **Text never uses series colours** (they're too light for text on white). Labels use ink tokens, and a coloured swatch carries identity. The default categorical order passes colour-vision-deficiency separation checks for adjacent series in both modes. If you swap hues, keep that property: validate adjacent pairs under protanopia, deuteranopia and tritanopia simulation. ## Per-series colours Any series accepts `color`, with any CSS colour or token: ```tsx series={[ { key: "actual", label: "Actual" }, { key: "plan", label: "Plan", color: "var(--clui-context)", dashed: true }, ]} ``` A series with an explicit colour doesn't use up a palette slot, so the next series still gets `--clui-s1`. --- # Accessibility What's built in, and what it doesn't cover. ## Built in - **Structure.** Every chart is a `
` labelled by its title, with a screen-reader summary of what the chart shows (ranges, extremes, first and last values) linked through `aria-describedby`. - **Keyboard.** Each plot is focusable. Arrow keys move through points, bars, cells or slices; Home and End jump to the ends; Escape clears. The tooltip for the focused item is announced through a polite live region. - **Table view.** The **Table** button replaces the chart with a real `` (header cells, row headers) of the underlying data. **CSV** downloads it. - **Not colour alone.** Favorable and unfavorable changes carry an arrow and the words "favorable" or "unfavorable" for screen readers. Candlesticks use hollow vs filled. Forecasts are dashed and labelled. Legends always accompany two or more series. - **Contrast.** Text uses ink tokens, never series colours. Light-mode series colours that fall below 3:1 against white are relieved by labels and the table view. - **Reduced motion.** The only transitions (hover dimming) are disabled under `prefers-reduced-motion`. - **Focus visibility.** A 2px focus ring on every interactive element. ## What we tested Automated checks run in Chromium for every chart page: landmark structure, labelled controls, focusable plots and keyboard navigation. See `TEST_REPORT.md` in the repository for the exact coverage. **Not yet tested:** manual walkthroughs with screen readers (NVDA, JAWS, VoiceOver). We don't claim WCAG conformance. If you need a formal audit, test the charts in your own product context. ## Your part - Write a real title. The title is the chart's accessible name, and "Chart" tells nobody anything. - Put units in the subtitle. - Don't hide the toolbar unless the data is also available another way on the page. --- # Customization The charts are source files in your repo, so customising one means editing it. Some common changes and where to make them: | I want to… | Edit | |---|---| | Change brand colours or fonts | CSS variables in `core/charts.css` ([Theming](/docs/theming)) | | Change how numbers look everywhere | `core/format.ts` | | Restyle the tooltip | `.clui-tooltip` in `charts.css`; the markup is `ChartTooltip` in `core/frame.tsx` | | Change bar thickness | `maxBarSize` prop, or `GAP` and the band padding in `core/bars.tsx` | | Remove the Table / CSV buttons | `toolbar={false}`, or delete the toolbar in `core/frame.tsx` | | Change the legend | `Legend` in `core/frame.tsx` and `.clui-legend` in CSS | | Use smoother lines | `curve="monotone"` on line and area charts | | Translate built-in words ("Forecast", "Total", "Partial") | Search the chart file; they're plain strings near the top of each plot | ## Keep edits easy to merge - **Prefer props and CSS variables** over edits when they exist. They survive updates. - **Make core edits deliberately.** `core/` is shared by every chart, so a change there affects all of them, which is usually what you want for formatting and theme. - **Commit charts before updating** with `--overwrite`, then review the diff and reapply your changes. ## Tooltip content Every tooltip is a `TooltipData` object: a title, rows of `{ label, value, color?, note?, strong? }` and an optional footer. To add a field, find where the chart builds its tooltip (search for `ChartTooltip`) and add a row: ```tsx rows: [ { label: "Revenue", value: formatValue(v, format, { context: "tooltip" }) }, { label: "Margin", value: formatValue(margin[i], "percent") }, // added ], ``` ## Events Charts don't expose click callbacks by default. Adding one is a two-line change in the chart file, for example on bars in `core/bars.tsx`: ```tsx props.onBarClick?.(cats[i])} style={{ cursor: "pointer" }} /> ``` Add `onBarClick?: (category: string) => void` to the props interface. --- # Composition There are three ways to build something the catalogue doesn't have, from least to most work. ## 1. Compose charts side by side Dashboard blocks are ordinary React layouts of charts. The Pro blocks (`BudgetVsActualBoard`, `SaasMetricsBoard`, `PnlSummary`) are written this way, and you can copy their pattern: ```tsx import { KpiRow } from "@/components/charts/kpi-row"; import { LineChart } from "@/components/charts/line-chart"; import { DivergingBarChart } from "@/components/charts/diverging-bar-chart"; export function GrowthReview({ kpis, monthly, regions }) { return (
); } ``` `minmax(min(100%, 420px), 1fr)` keeps the grid from overflowing on phones. ## 2. Wrap a chart with your defaults Thin wrappers keep product-wide conventions in one place: ```tsx import { LineChart, type LineChartProps } from "@/components/charts/line-chart"; /** Revenue charts: currency, no zero baseline, our source line. */ export function RevenueLine(props: Omit) { return ; } ``` ## 3. Build a new chart on the core Every chart follows the same recipe: validate, describe, frame, draw. Here's a complete minimal lollipop chart: ```tsx "use client"; import { ChartFrame, ChartTooltip, useActiveIndex, type FrameProps } from "./core/frame"; import { XLabels, YGrid, axisWidth } from "./core/axis"; import { checkRows, column, type Row } from "./core/data"; import { formatValue, tickFormatter, type FormatInput } from "./core/format"; import { bandScale, linearScale, valueDomain } from "./core/scale"; interface LollipopProps extends FrameProps { data: Row[]; x: string; y: string; format?: FormatInput; } export function LollipopChart({ data, x, y, format, height = 260, ...frame }: LollipopProps) { const issues = checkRows(data, { xKey: x, valueKeys: [y] }); const rows = Array.isArray(data) ? data : []; const values = column(rows, y).values; const table = { columns: [{ key: "x", label: x }, { key: "v", label: y, align: "right" as const, format: (v: unknown) => formatValue(v as number, format) }], rows: rows.map((r, i) => ({ x: r[x], v: values[i] })), }; return ( {({ width }) => String(r[x]))} values={values} format={format} />} ); } function Plot({ width, height, labels, values, format }: { width: number; height: number; labels: string[]; values: (number | null)[]; format?: FormatInput }) { const { active, setActive, keyProps } = useActiveIndex(values.length); const { domain, ticks } = valueDomain(values.filter((v): v is number => v !== null), { includeZero: true }); const fmt = tickFormatter(format, ticks); const left = axisWidth(ticks.map(fmt)); const y = linearScale(domain, [height - 24, 10]); const band = bandScale(values.length, [left, width - 8]); const cx = (i: number) => band(i) + band.bandwidth / 2; return ( <> cx(i))} labels={labels} y={height - 7} /> {values.map((v, i) => v === null ? null : ( setActive(i)} onPointerLeave={() => setActive(null)}> ), )} {active !== null && ( )} ); } ``` What the frame gives you for free: title, subtitle, legend, table view, CSV export, notes, the error state, the error boundary, the screen-reader summary and responsive width. --- # Using with AI coding agents ChartslibraryUI is designed so that a coding agent (Claude Code, Cursor, Copilot, v0, Codex…) can pick the right chart, install it and wire it to your data without guessing. ## Connect through the shadcn MCP server The shadcn MCP server lets an agent search registries and install components by name. Add the ChartslibraryUI namespace to `components.json` once: ```json { "registries": { "@chartslibraryui": "https://chartslibraryui.com/r/{name}.json" } } ``` Then set up the MCP server for your client (Claude Code shown; `cursor`, `vscode` and `opencode` also work): ```bash npx shadcn@latest mcp init --client claude ``` Restart the agent and ask for a chart, for example "add a revenue chart with the forecast marked". It can now search and install free charts directly, e.g. `npx shadcn@latest add @chartslibraryui/line-chart`. Pro charts install from your local Pro download (see below), so no key is needed. ## Machine-readable files | File | Contents | |---|---| | [`/llms.txt`](/llms.txt) | Index: every chart with a one-line purpose, plus links | | [`/llms-full.txt`](/llms-full.txt) | Everything an agent needs in one file: docs, per-chart guidance, data shapes, install commands | | [`/charts.json`](/charts.json) | Structured catalogue: names, tiers, categories, use/avoid guidance, data shapes, related charts | | [`/r/index.json`](/r/index.json) | Registry index (shadcn format), also at [`/r/registry.json`](/r/registry.json) | | `/r/.json` | One chart's files and dependencies | All of them are generated from the same catalogue as this site, so they never disagree with it. ## Add to your agent instructions Paste this into `CLAUDE.md`, `AGENTS.md`, `.cursorrules` or similar: ```md ## Charts - Use ChartslibraryUI components from `components/charts/` for all charts. - Before choosing a chart, read https://chartslibraryui.com/llms.txt and follow each chart's "Avoid when" guidance. - Install missing charts with `npx chartslibraryui add ` (Pro: add `--from ./chartslibraryui-pro`). - Data is an array of row objects plus the keys to read; use null for missing values, never 0. - Percent values are fractions (0.12 = 12%). Use favorable="down" for costs, churn and latency. - Never add a second y-axis: use ComboChart, IndexChart or SmallMultiples. - Give every chart a title that states the takeaway and a subtitle with unit and period. ``` ## Why it works well with agents - **Predictable names.** `Chart` components in `-chart.tsx` files, with typed props. - **One data convention.** Rows plus keys everywhere, so agents don't need to learn a per-chart format. - **Visible failures.** Bad data produces a message on the chart, not a blank square, so an agent (or a person) reviewing a screenshot sees what went wrong. - **Guidance next to code.** Each chart page and `llms-full.txt` say when **not** to use a chart and what to use instead. --- # Troubleshooting ### The chart is unstyled: black text, no grid, oversized legend `charts.css` isn't imported. Add `import "@/components/charts/core/charts.css"` once, in your root layout or entry file. ### Nothing renders, or there's a blank space the size of the chart Charts measure their container width. If the parent has no width (for example an unconstrained flex child), give it one: `min-width: 0` on flex children, or an explicit width. You can also pass `width={600}` to fix it. ### "This chart can't be drawn" The data failed validation, and the message says which key and which values. Common causes: - Numbers arriving as strings from an API or CSV (`"1200"`). Convert with `Number()` before charting. - A typo in a key (`x="Month"` vs `month`). - Negative values in a part-of-whole chart. ### Dates are off by one day You're probably parsing dates yourself with `new Date("2026-03-01")` and formatting in local time. Pass the ISO string with `xType="time"`; charts read date-only strings as UTC. ### Colours don't switch in dark mode The charts look for `.dark` or `[data-theme="dark"]` on an ancestor. If your theme switcher uses another class, add a rule that sets the dark tokens for it, or pass `mode="dark"`. ### Hydration warnings in Next.js Charts render a sized placeholder on the server and draw after measuring in the browser, so they don't cause hydration mismatches themselves. If you compute data with `Math.random()` or `Date.now()` during render, move that into an effect or onto the server. ### The x-axis skips labels Labels are thinned so they never overlap. Every value is still in the tooltip and table. For fewer, wider labels, shorten them ("Jan" rather than "January 2026") or give the chart more width. ### TypeScript can't find `@/components/...` Your project uses a different path alias. Change the import, or install with `--dir` to match your structure. The charts import each other with relative paths. ### Can I use this without TypeScript? Yes. Strip the types with any TS-to-JS tool, or let your bundler compile `.tsx`. Most React setups (Next.js, Vite) handle `.tsx` out of the box. --- # Chart reference ## Line chart (`LineChart`, free) A React line chart for dashboards: honest gaps for missing data, forecast and partial-period marking, direct end labels, crosshair tooltip, keyboard and table view. Install: `npx chartslibraryui add line-chart` Import: `import { LineChart } from "@/components/charts/line-chart";` Use for: - One metric over time, or up to four that share a unit - Actual against plan or last year on the same scale - One highlighted series against grey context series - Rates that move in a narrow band (set zero={false}) Avoid when: - Series are in different units: don't add a second axis Use combo-chart instead. - More than four or five series overlap Use small-multiples instead. - Only two points in time matter Use slope-chart instead. - You're showing parts of a total Use stacked-area-chart instead. Good practice: - Write the takeaway as the title and the unit and period in the subtitle. - Use forecastFrom so forecast periods are dashed and shaded, never mistaken for actuals. - Leave missing values as null; the chart draws a gap and says how many are missing. - Use highlight to put one series in colour and the rest in grey. Data: An array of rows, one per period, with an x key (label or date) and one numeric key per series. null for missing values. ```ts [{ month: "Jan 26", revenue: 1840000, plan: 1800000 }, ...] ``` Related: area-chart, step-line-chart, index-chart, actual-vs-forecast-chart ## Area chart (`AreaChart`, free) A React area chart for volume over time: zero baseline enforced, light 12% wash, gaps for missing data, crosshair tooltip and table view. Install: `npx chartslibraryui add area-chart` Import: `import { AreaChart } from "@/components/charts/area-chart";` Use for: - Volume or count over time (sessions, orders, tickets) - A single cumulative total - Adding visual weight to one headline trend Avoid when: - Two or more series overlap, so the areas hide each other Use line-chart instead. - Showing parts of a total Use stacked-area-chart instead. - The values are rates that don't start near zero Use line-chart instead. Good practice: - Areas always start at zero; that is what the filled area encodes. - Keep to one series, or two at most. - Use a line chart if you need to zoom in on a narrow range. Data: Rows with an x key and one numeric value key per series. ```ts [{ week: "W1", sessions: 48210 }, ...] ``` Related: line-chart, stacked-area-chart, sparkline ## Stacked area chart (`StackedAreaChart`, free) A React stacked area chart for totals and their composition over time, with a 100% mode, negative-value checks, and total and share in the tooltip. Install: `npx chartslibraryui add stacked-area-chart` Import: `import { StackedAreaChart } from "@/components/charts/stacked-area-chart";` Use for: - Revenue by product or plan over time - Composition of a total over many periods (normalize for shares) - Showing the total and its parts at once Avoid when: - Precise comparison of a middle layer matters; only the bottom layer has a flat baseline Use small-multiples instead. - Any series can be negative Use stacked-bar-chart instead. - Few periods and the mix shift is the story Use mix-shift-chart instead. Good practice: - Put the most stable or most important series at the bottom. - Keep to five or six layers. - A missing value breaks the whole column; the chart won't invent a total. Data: Rows with an x key and one non-negative numeric key per layer. ```ts [{ month: "Jan", starter: 88000, team: 164000, business: 212000 }, ...] ``` Related: area-chart, stacked-bar-chart, mix-shift-chart ## Step line chart (`StepLineChart`, free) A React step line chart for values that change at discrete moments and hold, such as prices, interest rates, plan tiers and headcount. Install: `npx chartslibraryui add step-line-chart` Import: `import { StepLineChart } from "@/components/charts/step-line-chart";` Use for: - Price or rate changes - Headcount or seat counts - Configuration values or limits over time Avoid when: - The value changes continuously (a sloped line is more honest) Use line-chart instead. Good practice: - Use a time axis (xType="time") when changes happen at irregular dates. - Include the current date as the last row so the final step extends to today. Data: Rows with an x key (category or date) and the value in effect from that point. ```ts [{ date: "2025-06-01", price: 18 }, ...] ``` Related: line-chart, area-chart ## Index chart (`IndexChart`, free) A React index chart that rebases series to 100 at a base period, the honest alternative to a dual-axis chart for comparing growth across units. Install: `npx chartslibraryui add index-chart` Import: `import { IndexChart } from "@/components/charts/index-chart";` Use for: - Comparing growth of measures in different units (revenue vs users vs headcount) - Relative performance against a benchmark - Replacing a dual-axis chart Avoid when: - The absolute level matters more than growth Use small-multiples instead. - A series is zero or missing at the base period Good practice: - Say the base period in the subtitle ("Jan 2025 = 100"). - Choose a base period that isn't an outlier. Data: Rows with an x key and numeric keys; every series needs a non-zero value at the base period. ```ts [{ month: "Jan", revenue: 1.2e6, customers: 840 }, ...] ``` Related: line-chart, combo-chart, small-multiples ## Sparkline (`Sparkline`, free) A React sparkline component: a responsive inline trend with gaps for missing values, an end dot and an accessible summary label. Install: `npx chartslibraryui add sparkline` Import: `import { Sparkline } from "@/components/charts/sparkline";` Use for: - Trend context inside KPI tiles and tables - Many small trends at a glance Avoid when: - Readers need values or axes Use line-chart instead. Good practice: - Always pair with the actual number; a sparkline shows shape, not magnitude. - Use the same time window for every sparkline in a table. Data: An array of numbers (null for gaps), oldest first. ```ts [412, 430, 428, null, 455, 471] ``` Related: kpi-tile, table-chart ## Bar chart (`BarChart`, free) A React bar (column) chart with a zero baseline enforced, value labels that only show when they fit, highlights, partial-period marking and a table view. Install: `npx chartslibraryui add bar-chart` Import: `import { BarChart } from "@/components/charts/bar-chart";` Use for: - One measure across periods (monthly new revenue) - A handful of categories - Showing an incomplete current period honestly Avoid when: - Category names are long or there are many categories Use horizontal-bar-chart instead. - You want to emphasise the trend more than each period Use line-chart instead. Good practice: - Bars always start at zero; a truncated bar axis exaggerates differences. - Mark the current, incomplete period with partialFrom. - Highlight the one bar the story is about. Data: Rows with a category key and one numeric value key. ```ts [{ month: "Jan", newMrr: 34200 }, ...] ``` Related: horizontal-bar-chart, grouped-bar-chart, stacked-bar-chart ## Horizontal bar chart (`HorizontalBarChart`, free) A React horizontal bar chart for ranked comparisons with long labels: sorted by default, value labels at bar ends, highlight and table view. Install: `npx chartslibraryui add horizontal-bar-chart` Import: `import { HorizontalBarChart } from "@/components/charts/horizontal-bar-chart";` Use for: - Ranking items (regions, products, features) - Long category names - More than about eight categories Avoid when: - The categories are periods in time Use bar-chart instead. - Values are positive and negative changes Use diverging-bar-chart instead. Good practice: - Sort by value unless the categories have a natural order. - Label values at the bar ends and drop the axis. - Highlight the item that matters, keep the rest grey. Data: Rows with a label key and one numeric value key. ```ts [{ region: "North America", revenue: 4820000 }, ...] ``` Related: bar-chart, dot-plot, diverging-bar-chart ## Grouped bar chart (`GroupedBarChart`, free) A React grouped bar chart for comparing two to four measures per category, such as this year vs last year, with consistent series colours and a table view. Install: `npx chartslibraryui add grouped-bar-chart` Import: `import { GroupedBarChart } from "@/components/charts/grouped-bar-chart";` Use for: - This year vs last year by quarter - Two or three segments compared per category Avoid when: - More than four series Use small-multiples instead. - The change between the two values is the story Use dumbbell-chart instead. Good practice: - Put the comparison (last year) in grey and the current period in the accent. - Keep the series order consistent across charts. Data: Rows with a category key and one numeric key per series. ```ts [{ quarter: "Q1", lastYear: 2.9e6, thisYear: 3.4e6 }, ...] ``` Related: bar-chart, stacked-bar-chart, dumbbell-chart ## Stacked bar chart (`StackedBarChart`, free) A React stacked bar chart with totals, 100% mode, negative values stacked below zero, 2px segment gaps and tooltips that list every part and the total. Install: `npx chartslibraryui add stacked-bar-chart` Import: `import { StackedBarChart } from "@/components/charts/stacked-bar-chart";` Use for: - Totals and their composition per period - Inflows and outflows (positive and negative parts) - Composition across categories (normalize) Avoid when: - Readers need to compare middle segments precisely Use grouped-bar-chart instead. - Many periods: the stack becomes noise Use stacked-area-chart instead. Good practice: - Put the series compared most often at the bottom, on the baseline. - Use at most five or six segments. - Total labels are hidden automatically when stacks mix signs, because a net label above the positive stack misleads. Data: Rows with a category key and one numeric key per segment. Negative values stack downward. ```ts [{ month: "Jan", newMrr: 34000, expansion: 9100, churned: -11200 }, ...] ``` Related: grouped-bar-chart, stacked-area-chart, variance-trend-chart ## Diverging bar chart (`DivergingBarChart`, free) A React diverging bar chart for signed changes, where colour follows whether the change is favorable (cost down is good), not the sign. Install: `npx chartslibraryui add diverging-bar-chart` Import: `import { DivergingBarChart } from "@/components/charts/diverging-bar-chart";` Use for: - Change by region or product - Variance by line item - Net scores (NPS change, sentiment) Avoid when: - You need the levels as well as the variance Use variance-chart instead. Good practice: - Set favorable="down" for costs, churn or latency. - Sort by value so the largest movers sit at the ends. Data: Rows with a label key and a signed numeric key. ```ts [{ item: "Cloud", change: 17800 }, { item: "Travel", change: -4700 }] ``` Related: horizontal-bar-chart, variance-chart, waterfall-chart ## Dot plot (`DotPlot`, free) A React dot plot for comparing many items on one scale, with an optional prior-period dot and favorable-coloured connector. Less ink than bars. Install: `npx chartslibraryui add dot-plot` Import: `import { DotPlot } from "@/components/charts/dot-plot";` Use for: - Rates in a narrow band (conversion by segment) - Current vs prior per item - Long lists where bars would be heavy Avoid when: - Magnitude from zero matters Use horizontal-bar-chart instead. Good practice: - Dots encode position, so the axis doesn't need zero; say so if it matters. - Sort by value. Data: Rows with a label key, a value key and optionally a comparison key. ```ts [{ region: "Nordics", margin: 0.31, prior: 0.29 }, ...] ``` Related: dumbbell-chart, horizontal-bar-chart, slope-chart ## Slope chart (`SlopeChart`, free) A React slope chart comparing two periods per item, with collision-free labels and lines coloured by favorable direction or a highlight. Install: `npx chartslibraryui add slope-chart` Import: `import { SlopeChart } from "@/components/charts/slope-chart";` Use for: - Market share then vs now - Before/after for up to ~10 items Avoid when: - More than about 10 items Use dot-plot instead. - More than two time points Use line-chart instead. Good practice: - Highlight the one or two items the story is about. - Label both ends with values; skip the axis. Data: Rows with a label key and two numeric keys (from, to). ```ts [{ vendor: "Ours", y2024: 0.142, y2026: 0.187 }, ...] ``` Related: dumbbell-chart, dot-plot, line-chart ## Donut chart (`DonutChart`, free) A React donut chart with the total in the centre, a value-and-share legend, '<1%' for tiny slices, automatic 'Other' folding and rejection of negative values. Install: `npx chartslibraryui add donut-chart` Import: `import { DonutChart } from "@/components/charts/donut-chart";` Use for: - One whole split into two to six parts - A share-of-total headline Avoid when: - More than six parts or precise comparison Use horizontal-bar-chart instead. - Comparing composition across periods Use mix-shift-chart instead. - Any value is negative Good practice: - Order slices deliberately; the chart keeps your order. - Use highlight to colour only the slice that matters. - Folding small slices into Other is stated in a note, never silent. Data: Rows with a label key and a non-negative value key. ```ts [{ source: "Organic search", visits: 48200 }, ...] ``` Related: pie-chart, waffle-chart, treemap ## Pie chart (`PieChart`, free) A React pie chart for two to five parts of a whole, with a share legend, tiny-slice handling and validation that rejects negative values. Install: `npx chartslibraryui add pie-chart` Import: `import { PieChart } from "@/components/charts/pie-chart";` Use for: - Two to five parts of a single whole - When the audience expects a pie Avoid when: - More than five parts, or close values Use horizontal-bar-chart instead. - You want a centre total Use donut-chart instead. Good practice: - Prefer a bar chart when values are close, because angles are hard to compare. - Never use 3D or exploded slices. Data: Rows with a label key and a non-negative value key. ```ts [{ plan: "Team", customers: 820 }, ...] ``` Related: donut-chart, waffle-chart ## Treemap (`Treemap`, free) A React treemap (squarified layout) for many parts of a whole, with one level of grouping, readable in-tile labels and share-of-total tooltips. Install: `npx chartslibraryui add treemap` Import: `import { Treemap } from "@/components/charts/treemap";` Use for: - Spend by vendor grouped by category - Spotting the few items that dominate a total Avoid when: - Exact ranking matters Use horizontal-bar-chart instead. - Values can be negative Good practice: - Group one level at most. - Use the table view for the long tail of tiny tiles. Data: Rows with a label key, a positive value key and an optional group key. ```ts [{ name: "Cloud hosting", group: "Infrastructure", value: 96000 }, ...] ``` Related: donut-chart, horizontal-bar-chart ## Waffle chart (`WaffleChart`, free) A React waffle chart where one square is 1%, with largest-remainder allocation so squares always add to 100, and a single-rate mode. Install: `npx chartslibraryui add waffle-chart` Import: `import { WaffleChart } from "@/components/charts/waffle-chart";` Use for: - A single rate ("64 in 100 accounts are active") - Two to four parts of a whole for general audiences Avoid when: - Small differences matter; the resolution is one percent Use horizontal-bar-chart instead. Good practice: - Pass total to show a single rate against the remainder. - Keep to four parts or fewer. Data: Rows with a label key and a non-negative value key; optional total. ```ts [{ label: "Active weekly", value: 0.64 }, ...] ``` Related: donut-chart, pie-chart ## Scatter chart (`ScatterChart`, free) A React scatter plot with optional bubble size, up to three groups, quadrant lines, a least-squares trend line, point labels and nearest-point tooltips. Install: `npx chartslibraryui add scatter-chart` Import: `import { ScatterChart } from "@/components/charts/scatter-chart";` Use for: - Two measures per item (seats vs ARR) - Spotting outliers and clusters - Quadrant analysis Avoid when: - More than a few thousand points Use heatmap instead. - One measure over time Use line-chart instead. Good practice: - Name both axes with units. - Never clip outliers; the chart always shows every point. - A trend line describes association, not cause. Data: Rows with two numeric keys; optional size, group and name keys. ```ts [{ account: "Acme", seats: 240, arr: 98000, segment: "Mid-market" }, ...] ``` Related: histogram, strip-plot, box-plot ## Histogram (`Histogram`, free) A React histogram with Freedman–Diaconis binning on round edges, a median or mean marker, small-sample warnings and a binned table view. Install: `npx chartslibraryui add histogram` Import: `import { Histogram } from "@/components/charts/histogram";` Use for: - Deal sizes, response times, session lengths - Checking skew and long tails Avoid when: - Fewer than ~20 observations Use strip-plot instead. - Comparing several groups Use box-plot instead. Good practice: - Try a couple of bin counts; the shape can change. - Mark the median for skewed data, not the mean. Data: An array of numbers, or rows plus a value key. ```ts [14800, 22100, 9800, ...] ``` Related: box-plot, strip-plot, scatter-chart ## Strip plot (`StripPlot`, free) A React strip plot (jittered dot plot) showing every observation by group with a median tick, which is honest for small and medium samples. Install: `npx chartslibraryui add strip-plot` Import: `import { StripPlot } from "@/components/charts/strip-plot";` Use for: - Small and medium samples by group - Showing how few points a summary rests on Avoid when: - Thousands of points per group Use box-plot instead. Good practice: - Jitter is deterministic, so the chart doesn't change between renders. - Use the table view for summary statistics. Data: Long-format rows with a group key and a numeric value key. ```ts [{ tier: "Priority", hours: 1.4 }, ...] ``` Related: box-plot, histogram ## KPI tile (`KpiTile`, free) A React KPI tile / stat card with value, signed delta vs a named comparison, favorable-aware colour, percentage-point deltas for rates and a sparkline. Install: `npx chartslibraryui add kpi-tile` Import: `import { KpiTile } from "@/components/charts/kpi-tile";` Use for: - The three to five numbers a dashboard leads with - A number that needs its comparison next to it Avoid when: - The trend is the message Use line-chart instead. Good practice: - Always name the comparison ("vs last year"). - Set favorable="down" for costs, churn and latency. - Rates compare in percentage points by default. Data: A value, optionally a comparison value, a format and a trend array. ```ts { label: "ARR", value: 18420000, compare: 15960000, format: "currency" } ``` Related: kpi-row, sparkline, bullet-chart ## KPI row (`KpiRow`, free) A responsive React KPI row: a grid of stat tiles with consistent sizing that wraps at a minimum tile width. Install: `npx chartslibraryui add kpi-row` Import: `import { KpiRow } from "@/components/charts/kpi-row";` Use for: - The top of a dashboard - Summary blocks in reports Avoid when: - More than about six numbers Use table-chart instead. Good practice: - Order tiles by importance, left to right. - Use the same comparison period for every tile. Data: An array of KPI tile props. ```ts [{ label: "ARR", value: 18.4e6, compare: 15.9e6, format: "currency" }, ...] ``` Related: kpi-tile, bullet-chart ## Target bar chart (`TargetBarChart`, free) A React progress-to-target chart: actual bars with target markers and attainment percentages, coloured by whether the target is met. Install: `npx chartslibraryui add target-bar-chart` Import: `import { TargetBarChart } from "@/components/charts/target-bar-chart";` Use for: - Sales against quota by team - Spend against budget by department - OKR progress Avoid when: - You need qualitative ranges as well (poor/fair/good) Use bullet-chart instead. - Variance is signed or negative Use variance-chart instead. Good practice: - Use favorable="down" when staying under the target is the goal. Data: Rows with a label key, an actual key and a target key. ```ts [{ region: "EMEA", revenue: 2.9e6, target: 2.8e6 }, ...] ``` Related: bullet-chart, variance-chart, kpi-tile ## Combo chart (`ComboChart`, free) A React combo chart for bars and a line in different units, drawn as two aligned panels with one shared crosshair. The honest dual-axis replacement. Install: `npx chartslibraryui add combo-chart` Import: `import { ComboChart } from "@/components/charts/combo-chart";` Use for: - Orders (bars) and average order value (line) - Volume and rate on the same periods Avoid when: - Both measures share a unit Use line-chart instead. - Only growth matters Use index-chart instead. Good practice: - Each panel gets its own honest axis; bars always start at zero. - Put the measure readers care about most on top. Data: Rows with an x key and two numeric keys. ```ts [{ month: "Jan", orders: 12400, aov: 54.2 }, ...] ``` Related: index-chart, small-multiples, bar-chart ## Table chart (`TableChart`, free) A React data table chart: sortable columns, inline bars on a shared scale, favorable-coloured deltas, sparklines, a totals row and CSV export. Install: `npx chartslibraryui add table-chart` Import: `import { TableChart } from "@/components/charts/table-chart";` Use for: - Exact values plus visual comparison - Product or account reviews - Anything a reader will want to copy Avoid when: - The shape of a trend is the main message Use line-chart instead. Good practice: - Keep one bar column; more compete for attention. - Put the identifying column first. Data: Rows plus column definitions (text, number, bar, delta, sparkline). ```ts [{ product: "Core", revenue: 6.2e6, growth: 0.14, trend: [4.8, 5.0, 5.3] }, ...] ``` Related: kpi-row, sparkline, variance-chart ## Small multiples (`SmallMultiples`, free) React small multiples: a responsive grid of mini line, area or bar charts on a shared scale with synchronised hover across panels. Install: `npx chartslibraryui add small-multiples` Import: `import { SmallMultiples } from "@/components/charts/small-multiples";` Use for: - The same metric across many regions or products - Comparing shapes across five or more series Avoid when: - Two or three series that need precise comparison Use line-chart instead. Good practice: - Keep the shared scale; independent scales hide differences in level and are flagged in a note. - Order panels meaningfully (order="last-desc"). Data: Long-format rows: facet key, x key, value key. ```ts [{ region: "Nordics", month: "Jan", signups: 212 }, ...] ``` Related: line-chart, index-chart ## Waterfall chart (`WaterfallChart`, pro) A React waterfall chart for financial bridges: computed subtotals, favorable-aware colours, connector lines and a warning when given subtotals don't add up. Install: `npx chartslibraryui add waterfall-chart --from ./chartslibraryui-pro` Import: `import { WaterfallChart } from "@/components/charts/waterfall-chart";` Use for: - Plan to actual bridges - Revenue to operating income walks - Last year to this year by driver Avoid when: - The steps happen over time rather than as drivers Use variance-trend-chart instead. - Totals dwarf the steps so they become invisible; split the bridge or show steps only Good practice: - Start with a total; subtotals are computed, so the arithmetic always closes. - Set favorable="down" for cost bridges. - Keep to about 10 steps; group the rest. Data: An ordered list of steps: { label, value, kind: 'total' | 'step' | 'subtotal' }. ```ts [{ label: "Plan", value: 8.2e6, kind: "total" }, { label: "Volume", value: 640000 }, { label: "Actual", kind: "subtotal" }] ``` Related: variance-chart, variance-trend-chart, pnl-summary ## Variance chart (`VarianceChart`, pro) A React budget-vs-actual variance chart: level bars with plan ticks next to favorable-coloured variance bars and % variance, with per-row direction for mixed P&L lines. Install: `npx chartslibraryui add variance-chart --from ./chartslibraryui-pro` Import: `import { VarianceChart } from "@/components/charts/variance-chart";` Use for: - Budget vs actual by cost centre - Revenue and cost lines vs plan - Monthly business reviews Avoid when: - The question is what drove one total Use waterfall-chart instead. Good practice: - Pass favorable={{ key }} when a table mixes income and cost lines. - Keep P&L order unless sorting by variance helps the story. Data: Rows with a label key, an actual key and a plan key; optional per-row favorable key. ```ts [{ category: "Travel", amount: 22100, budget: 30000 }, ...] ``` Related: waterfall-chart, diverging-bar-chart, budget-vs-actual-board ## Variance trend (`VarianceTrendChart`, pro) A React variance trend chart: monthly variance drivers stacked either side of zero with the net variance as a dot, to show whether the same driver keeps you behind. Install: `npx chartslibraryui add variance-trend-chart --from ./chartslibraryui-pro` Import: `import { VarianceTrendChart } from "@/components/charts/variance-trend-chart";` Use for: - Monthly variance to plan by driver (volume, price, mix, FX) - Seeing whether a miss is persistent or one-off Avoid when: - One period only Use waterfall-chart instead. Good practice: - Keep drivers in the same order every month. - Four drivers or fewer. Data: Rows with an x key and one signed key per driver. ```ts [{ month: "Jan", volume: 82000, price: 14000, mix: -21000, fx: -6000 }, ...] ``` Related: waterfall-chart, stacked-bar-chart ## Bullet chart (`BulletChart`, pro) A React bullet chart: one row per KPI with its own scale, grey qualitative bands, actual bar and target tick. Fits many KPIs in the space of one gauge. Install: `npx chartslibraryui add bullet-chart --from ./chartslibraryui-pro` Import: `import { BulletChart } from "@/components/charts/bullet-chart";` Use for: - Several KPIs against targets on one panel - Attainment with poor/fair/good ranges Avoid when: - No targets or ranges exist Use kpi-row instead. Good practice: - Each row has its own format and scale, so mixed units are fine. - Bands are grey; colour is reserved for the actual. Data: An array of { label, actual, target, bands, format }. ```ts [{ label: "New ARR", actual: 2.64e6, target: 3e6, bands: [2.1e6, 2.7e6, 3.3e6], format: "currency" }] ``` Related: target-bar-chart, kpi-tile ## Football field (`FootballFieldChart`, pro) A React football field chart for valuation ranges by method, with labelled reference lines (offer price, current price) and low > high validation. Install: `npx chartslibraryui add football-field-chart --from ./chartslibraryui-pro` Import: `import { FootballFieldChart } from "@/components/charts/football-field-chart";` Use for: - Valuation summaries - Scenario ranges for a forecast - Price ranges by method Avoid when: - You have a full distribution, not a range Use box-plot instead. Good practice: - Order methods deliberately (market, intrinsic, transaction). - Label the reference line with its value. Data: Rows with a label key and low/high numeric keys. ```ts [{ method: "DCF", low: 455, high: 590 }, ...] ``` Related: box-plot, dumbbell-chart ## Pareto chart (`ParetoChart`, pro) A React Pareto chart with bars and the cumulative curve on one 0–100% axis (no dual axis), an 80% marker and a pinned 'Other' category. Install: `npx chartslibraryui add pareto-chart --from ./chartslibraryui-pro` Import: `import { ParetoChart } from "@/components/charts/pareto-chart";` Use for: - Ticket causes, defect types, revenue concentration - Deciding what to fix first Avoid when: - Categories have a natural order Use bar-chart instead. Good practice: - Pin "Other" last with pinLast. - The threshold is a convention, not a law; say why you use 80%. Data: Rows with a category key and a non-negative value key. ```ts [{ cause: "Login & SSO", tickets: 1240 }, ...] ``` Related: horizontal-bar-chart, treemap ## Actual vs forecast (`ActualVsForecastChart`, pro) A React actual vs forecast chart: solid actuals, dashed forecast joined at the last actual, shaded forecast period, plan line, bands and an end-of-horizon callout vs plan. Install: `npx chartslibraryui add actual-vs-forecast-chart --from ./chartslibraryui-pro` Import: `import { ActualVsForecastChart } from "@/components/charts/actual-vs-forecast-chart";` Use for: - Revenue or demand forecasts against plan - Latest estimate reviews - Any chart where forecast and actual share a line Avoid when: - Uncertainty is the main message Use fan-chart instead. - Month-to-date pacing Use pacing-chart instead. Good practice: - Keep actual and forecast in separate keys; the chart joins them honestly. - Say when the forecast was made in the subtitle. Data: Rows with an x key, an actual key (null in the future), a forecast key, and optional plan and band keys. ```ts [{ month: "Aug", actual: 2.31e6, forecast: null, plan: 2.23e6 }, { month: "Sep", actual: null, forecast: 2.40e6, plan: 2.29e6 }] ``` Related: fan-chart, pacing-chart, line-chart ## Fan chart (`FanChart`, pro) A React fan chart for forecasts with 50% and 80% intervals, actual history, a central forecast line and checks that bounds are ordered. Install: `npx chartslibraryui add fan-chart --from ./chartslibraryui-pro` Import: `import { FanChart } from "@/components/charts/fan-chart";` Use for: - Forecasts where uncertainty matters - Scenario communication to executives Avoid when: - You don't have real interval estimates; don't draw invented bands Good practice: - Label what the bands mean ("80% of simulated outcomes"). - Don't set zero when the series sits far from zero. Data: Rows with actual, forecast and lower/upper keys for one or two intervals. ```ts [{ month: "Mar", actual: null, forecast: 1260, p10: 1190, p90: 1330, p25: 1225, p75: 1295 }] ``` Related: actual-vs-forecast-chart, line-chart ## Pacing chart (`PacingChart`, pro) A React pacing chart for month-to-date or quarter-to-date tracking: cumulative actual vs plan with a run-rate projection to period end. Install: `npx chartslibraryui add pacing-chart --from ./chartslibraryui-pro` Import: `import { PacingChart } from "@/components/charts/pacing-chart";` Use for: - Will we land the month? - Bookings or spend pacing against plan Avoid when: - Values aren't cumulative Use actual-vs-forecast-chart instead. Good practice: - Run-rate projection assumes the pace to date continues; say so. - Show the whole period so the remaining gap is visible. Data: One row per day of the period with cumulative actual (null in the future) and cumulative plan. ```ts [{ day: "1", actual: 74000, plan: 80000 }, ...] ``` Related: actual-vs-forecast-chart, bullet-chart ## Heatmap (`Heatmap`, pro) A React heatmap with sequential and diverging scales, hatched missing cells (never zero), in-cell labels when they fit, keyboard navigation and a legend. Install: `npx chartslibraryui add heatmap --from ./chartslibraryui-pro` Import: `import { Heatmap } from "@/components/charts/heatmap";` Use for: - Channel by week vs plan - Hour by weekday activity - Item by month matrices Avoid when: - Readers need precise values for a few items Use table-chart instead. Good practice: - Use a diverging scale only when the centre means something (plan, zero). - Set a fixed domain to compare several heatmaps. Data: Long-format rows: row key, column key, value key. ```ts [{ channel: "Search", week: "W1", delta: 1.4 }, ...] ``` Related: cohort-heatmap, calendar-heatmap, table-chart ## Cohort heatmap (`CohortHeatmap`, pro) A React cohort retention chart: a triangle heatmap where unobserved cells stay blank, cohort sizes and a size-weighted average row from observed cells only. Install: `npx chartslibraryui add cohort-heatmap --from ./chartslibraryui-pro` Import: `import { CohortHeatmap } from "@/components/charts/cohort-heatmap";` Use for: - Customer or logo retention - Revenue retention (values above 100% allowed) - Payback curves by cohort Avoid when: - You only have one cohort Use line-chart instead. Good practice: - Use null for periods not yet observed, never 0. - Pass size so the average is weighted correctly. Data: An array of cohorts: { cohort, size, values[] } where values are fractions of the starting cohort. ```ts [{ cohort: "Jan 26", size: 340, values: [1, 0.78, 0.72, null] }] ``` Related: heatmap, line-chart ## Calendar heatmap (`CalendarHeatmap`, pro) A React calendar heatmap for daily data: weekly rhythm, seasonality and outages at a glance, UTC-safe dates, empty days left empty. Install: `npx chartslibraryui add calendar-heatmap --from ./chartslibraryui-pro` Import: `import { CalendarHeatmap } from "@/components/charts/calendar-heatmap";` Use for: - Daily active users - Deploys, incidents or sales per day Avoid when: - Exact day-to-day values matter Use line-chart instead. Good practice: - Pass ISO date strings; they're read as UTC so days never shift. - One calendar per year. Data: Rows with a date key and a numeric value key. ```ts [{ date: "2026-03-14", value: 5210 }, ...] ``` Related: heatmap, line-chart ## Candlestick chart (`CandlestickChart`, pro) A React candlestick chart with a separate volume panel (no dual axis), hollow-up/filled-down encoding and validation of malformed OHLC rows. Install: `npx chartslibraryui add candlestick-chart --from ./chartslibraryui-pro` Import: `import { CandlestickChart } from "@/components/charts/candlestick-chart";` Use for: - Daily or weekly prices - Trading or pricing dashboards Avoid when: - Only the close matters Use line-chart instead. Good practice: - Rising candles are hollow and falling filled, so direction never depends on colour. - Rows with high < open/close are rejected and listed, not silently fixed. Data: Rows with an x key and open, high, low, close (and optional volume) keys. ```ts [{ date: "2026-03-02", open: 142.1, high: 144.0, low: 141.2, close: 143.5, volume: 1.8e6 }] ``` Related: line-chart, box-plot ## Box plot (`BoxPlot`, pro) A React box plot with Tukey whiskers, every outlier drawn, n per group, optional raw points and a quartile table. Install: `npx chartslibraryui add box-plot --from ./chartslibraryui-pro` Import: `import { BoxPlot } from "@/components/charts/box-plot";` Use for: - Comparing distributions across groups - Response times by tier Avoid when: - Fewer than ~5 values per group Use strip-plot instead. Good practice: - Show points too when n is small. - Explain the box (middle half) and the whiskers for non-technical readers. Data: Long-format rows with a group key and a numeric value key. ```ts [{ tier: "Standard", hours: 4.2 }, ...] ``` Related: strip-plot, histogram ## Dumbbell chart (`DumbbellChart`, pro) A React dumbbell chart for before/after comparisons, sorted by change, with favorable-coloured connectors and printed deltas. Install: `npx chartslibraryui add dumbbell-chart --from ./chartslibraryui-pro` Import: `import { DumbbellChart } from "@/components/charts/dumbbell-chart";` Use for: - Conversion before and after a change - Prior vs current per segment Avoid when: - The level matters more than the change Use dot-plot instead. Good practice: - Sort by change. - Use percentage points for rate changes (the default for percent formats). Data: Rows with a label key and from/to numeric keys. ```ts [{ segment: "Starter", before: 0.031, after: 0.042 }] ``` Related: dot-plot, slope-chart ## Funnel chart (`FunnelChart`, pro) A React funnel chart with centred stage bars, step conversion and conversion from the top, and a warning when stages aren't nested. Install: `npx chartslibraryui add funnel-chart --from ./chartslibraryui-pro` Import: `import { FunnelChart } from "@/components/charts/funnel-chart";` Use for: - Signup to paid conversion - Sales pipeline stages Avoid when: - Stages aren't nested (a later stage can be larger) Use bar-chart instead. Good practice: - Report both step and overall conversion. - Use the same time window for every stage. Data: Rows in stage order with a stage key and a count key. ```ts [{ stage: "Visited pricing", value: 48200 }, ...] ``` Related: sankey-chart, bar-chart ## Sankey chart (`SankeyChart`, pro) A React sankey diagram for conserved flows (revenue to profit, budget to teams), with cycle rejection and warnings when a node's inflow and outflow don't balance. Install: `npx chartslibraryui add sankey-chart --from ./chartslibraryui-pro` Import: `import { SankeyChart } from "@/components/charts/sankey-chart";` Use for: - Revenue to costs and profit - Budget allocation - Traffic to outcomes Avoid when: - Flows aren't conserved or are cyclical Use funnel-chart instead. - Many small flows; it becomes a hairball Good practice: - Fix imbalance warnings in the data; they usually mean a missing line. - Highlight the path the story is about. Data: An array of links: { source, target, value }. ```ts [{ source: "Revenue", target: "Gross profit", value: 9.2 }, ...] ``` Related: funnel-chart, waterfall-chart ## Mix shift chart (`MixShiftChart`, pro) A React mix shift chart: 100% stacked columns joined by bands with in-segment shares and percentage-point changes in the tooltip. Install: `npx chartslibraryui add mix-shift-chart --from ./chartslibraryui-pro` Import: `import { MixShiftChart } from "@/components/charts/mix-shift-chart";` Use for: - Revenue mix by plan across years - Channel mix shift Avoid when: - Many periods Use stacked-area-chart instead. Good practice: - Two to six periods, up to eight parts. - Order parts consistently, the largest-growing at the top. Data: Rows with a period key and one non-negative key per part. ```ts [{ period: "2024", starter: 0.24, team: 0.35, business: 0.27, enterprise: 0.14 }] ``` Related: stacked-area-chart, stacked-bar-chart, donut-chart ## Budget vs actual board (`BudgetVsActualBoard`, pro) A ready-made React budget vs actual dashboard block: KPI row, cumulative spend against budget and variance by category, built from library charts. Install: `npx chartslibraryui add budget-vs-actual-board --from ./chartslibraryui-pro` Import: `import { BudgetVsActualBoard } from "@/components/charts/budget-vs-actual-board";` Use for: - Monthly budget reviews - Department spend dashboards Avoid when: - You need a different layout; compose the charts directly Good practice: - Pass favorable="up" for revenue boards. Data: Monthly rows (actual, budget) and category rows (actual, budget). ```ts monthly: [{ month: "Jan", actual: 312000, budget: 300000 }], categories: [{ category: "Travel", actual: 22100, budget: 30000 }] ``` Related: variance-chart, actual-vs-forecast-chart, kpi-row ## SaaS metrics board (`SaasMetricsBoard`, pro) A ready-made React SaaS metrics dashboard block: KPI tiles, MRR vs plan, MRR movements and a cohort retention heatmap. Install: `npx chartslibraryui add saas-metrics-board --from ./chartslibraryui-pro` Import: `import { SaasMetricsBoard } from "@/components/charts/saas-metrics-board";` Use for: - Board and investor updates - Internal SaaS dashboards Avoid when: - You need a different layout; compose the charts directly Good practice: - Use the same period for every tile's comparison. Data: KPI tile props, monthly MRR rows with movement keys, and cohorts. ```ts monthly: [{ month: "Jan 25", mrr: 438000, plan: 423000, newMrr: 26000, expansion: 9000, churned: -11000 }] ``` Related: kpi-row, stacked-bar-chart, cohort-heatmap ## P&L summary (`PnlSummary`, pro) A React P&L summary block: income statement table with plan and prior variances coloured per line (income vs cost), plus a waterfall walk with computed subtotals. Install: `npx chartslibraryui add pnl-summary --from ./chartslibraryui-pro` Import: `import { PnlSummary } from "@/components/charts/pnl-summary";` Use for: - Monthly or quarterly financial reviews - Board pack income statement pages Avoid when: - Detailed account-level P&L with hundreds of lines; use a real table component Good practice: - Mark cost lines favorable="down" so variances read correctly. - Mark computed lines as subtotal; they are checked against their components. Data: An ordered list of lines: { line, actual, plan, prior, favorable, subtotal }. ```ts [{ line: "Revenue", actual: 12.4e6, plan: 12e6, prior: 10.3e6, favorable: "up" }, ...] ``` Related: waterfall-chart, variance-chart