Job throughput
Jobs per period stacked by status, with the total and the success rate of the finished jobs written above.
- Domain
- Data display
- Support level
- Size
- Not measured
- Who uses it
- No live product imports it yet
import { JobThroughput } from "@krizaka/charts/throughput";Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.
Why it is here. Sovkora's jobs per period by status (PS-C).
When to use
- Sovkora's insights and the console's supervision: jobs per day by status.
- The mobile Jobs screen: the total and the success rate first, the week's bars under them.
- Any queue whose items end in success or failure: uploads, payouts, transcodes.
When not to use
- Money per period.Use instead: Earnings chart
- How long the jobs take.Use instead: Latency chart
- The share of each kind of job, without time.Use instead: Pie and donut chart
Installation
Install
npm install @krizaka/chartsImport
import { JobThroughput } from "@krizaka/charts/throughput";Examples
A week of jobs
Seven days of Sovkora jobs by status, the success rate above.
Live, per hour
The last hours, live, with the console's own statuses.
Props
Jobs per period, stacked by status, with the total and the success rate.
| Prop | Type | Default | Description |
|---|---|---|---|
datarequired | readonly T[] | — | The rows, in the order of the x axis. |
actionsMenu | boolean | — | The ⋯ actions menu of the kit. false: the former “Show data” and export buttons, drawn in line. Default true. |
autoRange | boolean | — | Zoom the time axis on the period that has data: the empty days before the first and after the last value are
left out (never fewer than minPoints), and a sparse period says so under the chart instead of drawing 13 empty
days around one bar. Default false. |
brand | BrandId | — | 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). |
className | string | — | A class on the figure (layout: margins, grid placement). |
dataTable | boolean | — | “View as table” in the actions menu (the table is in the page for screen readers either way). Default true. |
description | ReactNode | — | A sentence under the title: the period, the unit, the source. |
empty | ReactNode | — | What to show when there is nothing to draw (default: the empty label). An EmptyState of
@krizaka /ui fits. |
error | ReactNode | — | The data could not be loaded: true says the default words, a node says yours (a retry button…). |
exportable | boolean | readonly ExportFormat[] | — | The downloads of the actions menu: all three by default, or the formats you want, or false for none. |
filterable | boolean | — | The legend chips switch the series on and off. Default true. |
height | number | — | The height of the plot in pixels. Default 280 (a sparkline: 32). |
hideSummary | boolean | — | Hide the total and the success rate above the bars. |
hideTitle | boolean | — | Visually hide the title (it stays the chart's accessible name): a card that already has its heading. |
id | string | — | The id of the figure. |
insight | ReactNode | — | One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”. |
labels | Partial<ThroughputLabels> | — | The words, passed translated; English by default. |
legend | boolean | — | Show the legend (from two series). Default true. |
live | boolean | — | Streaming data (a job queue, an auction): no entrance on updates, no announcement of every new point. |
loading | boolean | — | The data is on its way: a skeleton of the chart, announced once. |
locale | Locale | — | The locale of every figure and date ("fr-FR"). Default "en-US". |
markers | readonly Marker[] | — | Vertical markers at a category: a launch, an incident. |
minPoints | number | — | With autoRange, the fewest categories to keep so a short burst still has a time scale. Default 7. |
onSelect | ((datum: T, index: number) => void) | — | Called with the row when a point or a bar is clicked (or Enter is pressed on it). |
period | CategoryFormat | day | How the periods are written. Default "day" (Oct 11); "time" for hours. |
statuses | readonly JobStatus[] | [
{ key: "completed", label: "Completed", tone: "success", outcome: "succeeded" },
{ key: "failed", label: "Failed", tone: "danger", outcome: "failed" },
{ key: "running", label: "Running", tone: "info" },
{ key: "queued", label: "Queued", tone: "neutral" },
] | The statuses, in stacking order, with their field, name and tone. Default: completed, failed, running, queued. |
style | CSSProperties | — | 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"). |
summaryText | string | — | Your own summary instead of the generated one (still read first by screen readers). |
thresholds | readonly Threshold[] | — | Horizontal lines at a value: a goal, a payout threshold. |
title | string | — | 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. |
x | string | ((datum: T, index: number) => unknown) | "day" as Accessor<T, unknown> | The field (or function) of the period. Default "day". |
xLabel | string | — | The header of the categories in the data table (Month). |
zero | boolean | — | Start the value axis at zero. Default: true for bars and areas; for lines, unless the values sit far from zero. |
Accessibility
- The statuses wear the status tones and are named in the legend: the colour is never alone.
- The total and the success rate are written above the chart, in words.
Keyboard
| Keys | Action |
|---|---|
| Tab | Moves the focus to the plot, then to the data and export buttons. |
| Arrow keys | Walk the periods: each one's counts by status are announced. |
Best practices
- Pass the statuses translated, in the order they should stack: the finished ones at the bottom.
- Mark the statuses that end a job with
outcome: only they count in the success rate. - Set
livewhen the counts stream in: no entrance on every update.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub