Krizaka
Documentation

Funnel

Stages that lose people on the way, with the conversion from each stage to the next and from the first written beside it.

WebBetaCharts

Web only — React, from @krizaka/charts/funnel. Beta: its API may still change in a minor version.

When to use

  • A sign-up or purchase journey: visit, sign-up, verification, first video, first sale.

When not to use

  • Flows that branch.Use instead: Sankey
  • Stages that do not contain each other.Use instead: Bar chart

Installation

Install

npm install @krizaka/charts

Import

import { Funnel } from "@krizaka/charts/funnel";

Examples

Sign-up funnel

Orochia's creator sign-up, from visit to first sale.

Creator sign-up, September

Funnel, 5. Visited the creator page → Created an account 20%, Created an account → Verified their identity 64%, Verified their identity → Published a first video 52%, Published a first video → Made a first sale 37%. Overall 2.4%.

Creator sign-up, September — data
StageCreators% of visits% of previous
Visited the creator page48,200100%—
Created an account9,64020%20%
Verified their identity6,17013%64%
Published a first video3,2106.7%52%
Made a first sale1,1802.4%37%

Props

PropTypeDefaultDescription
datarequiredreadonly T[]—One row per stage, first stage first.
labelrequiredstring | ((datum: T, index: number) => string)—The field (or function) naming the stage.
titlerequiredstring—What the chart shows, in a few words: its accessible name, and its heading unless hideTitle.
valuerequiredstring | ((datum: T, index: number) => number)—The field of how many reached it.
brandBrandId—The brand whose palette the charts use. Without it, a chart follows a .brand-<id> ancestor, else Krizaka. Set it when the app loads a brand stylesheet on :root (@krizaka/tokens/brands/orazaka.css).
classNamestring—A class on the figure (layout: margins, grid placement).
dataTableboolean—The "Show data" button (the table is in the page for screen readers either way). Default true.
descriptionReactNode—A sentence under the title: the period, the unit, the source.
emptyReactNode—What to show when there is nothing to draw (default: the empty label). An EmptyState of @krizaka /ui fits.
errorReactNode—The data could not be loaded: true says the default words, a node says yours (a retry button…).
exportableboolean | readonly ExportFormat[]—Export buttons: true for PNG, SVG and CSV, or the formats you want.
formatValueFormat—How the counts are written. Default "integer".
fromFirstLabelstring—The header of the share of the first stage. Default “% first”.
fromPreviousLabelstring—The header of the share of the previous stage. Default “% previous”.
heightnumber—The height of the plot in pixels. Default 280 (a sparkline: 32).
hideTitleboolean—Visually hide the title (it stays the chart's accessible name): a card that already has its heading.
idstring—The id of the figure.
labelsChartLabelsInput—The words, translated: the buttons, the states, the written summary.
liveboolean—Streaming data (a job queue, an auction): no entrance on updates, no announcement of every new point.
loadingboolean—The data is on its way: a skeleton of the chart, announced once.
localeLocale—The locale of every figure and date ("fr-FR"). Default "en-US".
rendererRenderer—svg (default): sharp, exportable as SVG. canvas: for tens of thousands of marks.
stageLabelstring—The headers of the data table: the stage, the count, the share of the first, of the previous.
styleCSSProperties—Inline style on the figure (layout only: colours come from the tokens).
summary"hidden" | "visible"—The written summary: read by screen readers only ("hidden", default), or shown under the chart ("visible").
summaryTextstring—Your own summary instead of the generated one (still read first by screen readers).
valueLabelstring—The header of the counts.

Accessibility

  • The plot is a group named by the title and described by a summary written from the data, read before anything else.
  • The data table is always in the page for assistive technology; “Show data” reveals it for everyone.
  • The engine (ECharts core and this one chart type) loads when the chart nears the screen; a skeleton of the same height holds its place, so nothing shifts.
  • Under reduced motion the chart is drawn without animation.
  • The summary says each step's conversion and the overall one.

Keyboard

KeysAction
TabMoves the focus to the plot (one tab stop), then to the data and export buttons.
Arrow keysWalk the items one by one: each is announced and highlighted, its tooltip shown.
Home / EndJump to the first or the last item.
EscHides the tooltip and clears the highlight.

Best practices

  • Order the stages as the journey goes; each count includes the next.
  • Name the columns of the table in your language (fromFirstLabel, fromPreviousLabel).

Generated from the code of @krizaka/ui 2.4.0: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page