Krizaka UI
Krizaka UI

Heatmap

A measure across two dimensions — activity by weekday and hour — in one sequential hue, with a step legend.

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 { Heatmap } from "@krizaka/charts/heatmap";

Web uniquement — React, depuis @krizaka/charts/heatmap. 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à. Merged into the calendar heat map, which is the one the products need. Removed with PS-C.

Quand l’utiliser

  • When something happens: uploads by weekday and hour, errors by service and day.
  • A matrix of two categorical dimensions with a value in each cell.

Quand ne pas l’utiliser

  • One value per day over a year.À la place : Calendar heatmap
  • Exact values matter more than the pattern.À la place : Bar chart

Installation

Installer

npm install @krizaka/charts

Importer

import { Heatmap } from "@krizaka/charts/heatmap";

Exemples

Activity by hour

Uploads by weekday and hour of the day: when a community is awake.

Props

PropTypeDéfautDescription
datarequisreadonly T[]—One row per cell.
valuerequisstring | ((datum: T, index: number) => number)—The field of the cell's value.
xrequisstring | ((datum: T, index: number) => unknown)—The field of the column (an hour, a day) and of the row (a weekday, a team).
yrequisstring | ((datum: T, index: number) => unknown)—The field of the row (a weekday, a team).
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.
formatValueFormat—How the values, the columns and the rows are written.
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".
rendererRenderer—svg (default): sharp, exportable as SVG. canvas: for tens of thousands of marks.
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).
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.
xCategoriesreadonly unknown[]—The order of the columns and the rows. Default: as they first appear.
xFormatCategoryFormat—How the columns are written.
xLabelstring—The headers of the data table.
yCategoriesreadonly unknown[]—The order of the rows. Default: as they first appear.
yFormatCategoryFormat—How the rows are written.
yLabelstring—The header of the rows in the data table.

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 cells are walked row by row; each is read with its row, column and value.

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

  • Give the order of the rows and columns (xCategories, yCategories): weekdays in order, not as they appear.
  • Keep empty cells empty: a missing value is not a zero.

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