Krizaka UI
Krizaka UI

Scatter chart

The relation between two measures, a bubble's area for a third, a colour per group, and the correlation said in words.

Web · ✓Mobile · ✗ à construireBureau · ✓BêtaGraphiques
Niveau de support
Bêta
Taille
Non mesurée
Qui l'utilise
Aucun produit en production ne l'importe encore
import { ScatterChart } from "@krizaka/charts/scatter";

Web uniquement — React, depuis @krizaka/charts/scatter. Bêta : son API peut encore changer à une version mineure.

  • Mobile · ✗ à construire. Advanced tier: no phone screen needs it yet. issue #280

Pourquoi il est là. No product plots two measures against each other. Removed with PS-C.

Quand l’utiliser

  • Whether two measures move together: a video's length and its watch time, a job's input and its duration.
  • Outliers in a population.

Quand ne pas l’utiliser

  • A trend over time.À la place : Line chart
  • Measures of a few entities on a common scale.À la place : Radar chart

Installation

Installer

npm install @krizaka/charts

Importer

import { ScatterChart } from "@krizaka/charts/scatter";

Exemples

Length and watch time

A creator's videos: length against average watch time, bubbles by views, a colour per format.

Props

PropTypeDéfautDescription
datarequisreadonly T[]—One row per point.
xrequisstring | ((datum: T, index: number) => number)—The fields of the two measures.
xLabelrequisstring—The names of the measures: the axes, the tooltip, the table.
yrequisstring | ((datum: T, index: number) => number)—The field of the vertical measure.
yLabelrequisstring—The name of the vertical measure.
actionsMenuboolean—The ⋯ actions menu of the kit. false: the former “Show data” and export buttons, drawn in line. Default true.
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/sovkora.css).
classNamestring—A class on the figure (layout: margins, grid placement).
dataTableboolean—“View as table” in the actions menu (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[]—The downloads of the actions menu: all three by default, or the formats you want, or false for none.
groupstring | ((datum: T, index: number) => string)—The field of a point's group: one colour per group (three at most read apart for everyone).
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.
insightReactNode—One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.
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".
namestring | ((datum: T, index: number) => string)—The field naming a point (the tooltip's title).
rendererRenderer—svg (default): sharp, exportable as SVG. canvas: for tens of thousands of marks.
sizestring | ((datum: T, index: number) => number)—A third measure, drawn as the bubble's area.
sizeFormatValueFormat—How the third measure (the bubbles) is written.
sizeLabelstring—The name of the third measure.
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).
thresholdsreadonly Threshold[]—Horizontal lines at a y value.
titlestring—What the chart shows, in a few words: its accessible name, and its heading unless hideTitle. Inside a ChartCard, the card's title is the default.
xFormatValueFormat—How each measure is written.
yFormatValueFormat—How the vertical measure is written.

Accessibilité

  • 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 gives both ranges and Pearson's correlation.

Clavier

TouchesAction
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.

Bonnes pratiques

  • Keep to three groups: past that, colours stop reading apart for everyone.
  • Use renderer="canvas" past a few thousand points.

Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page