Skip to content

Chart / sparkline

In review
Live · web

Time series: hover or tab a point, toggle a series in the legend

Cost · this week

total $189
$0$15$30MonTueWedThuFriSatSun

Request latency · this week

p50 / p95, per day
0 ms313 ms625 msMonTueWedThuFriSatSun

Categorical: same primitive, different data + value format

Tool calls · by family

124 total

Tokens · by model

2.7M this week

At-a-glance: sparkline stat tiles

This week

trend
Tokens
1.2M
Sessions
42

Progress / usage ring: drive it past each threshold

Context window

used
58%
healthy < 60 elevated 60 to 85 high ≥ 85

Series + grid + axes + ring bands are all var(--token). Cyan is the brand series, extra series use the categorical ramp, warm = status. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. Series colors are tokens: brand cyan
// (var(--color-accent-primary)) for the primary, the categorical ramp for the rest.
// Axes/grid bind to border + muted tokens; nothing is hardcoded. The selectable legend
// and card chrome stay in the CONSUMER; the chart primitives own only the plot.
import { NockerlLineChart, NockerlBarChart, NockerlSparkline, NockerlGauge } from '@dizyx/nockerl-react';
export function UsagePanel() {
return (
<>
{/* `area` is a TOP-LEVEL NockerlLineChart prop (fills under every series), not per-series.
Each series is { key, label, color, data }. There is no `legend` prop: the
consumer owns the legend/card chrome (compose NockerlChip toggles). */}
<NockerlLineChart
xLabels={['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']}
series={[
{ key: 'cloud', label: 'Cloud', color: 'var(--color-accent-primary)', data: cloud },
{ key: 'local', label: 'Local', color: 'var(--color-core-categorical-violet400)', data: local },
]}
area
/>
{/* NockerlBarChart takes `bars` ({ label, value, color }), where the color is per-bar (a
categorical tint or brand cyan). There is no `data` / `colorBy` prop. */}
<NockerlBarChart
bars={[
{ label: 'Edit', value: 42, color: 'var(--color-accent-primary)' },
{ label: 'Read', value: 31, color: 'var(--color-core-categorical-sky400)' },
{ label: 'Bash', value: 24, color: 'var(--color-core-categorical-emerald400)' },
]}
/>
<NockerlSparkline data={tokenTrend} color="var(--color-accent-primary)" showLast />
{/* The usage ring is the NockerlGauge primitive in its `ring` shape. It owns the
cyan < .60 → amber < .85 → red band semantics internally. */}
<NockerlGauge shape="ring" value={58} max={100} centerPrimary="58%" label="Context window 58% used" />
</>
);
}
PropTypeDefaultDescription
series (LineChart) *ChartSeries[]Each: key, label, a token color (a var(--color-…) string for brand cyan or a categorical tint), and data: number[]. The caller passes the already-filtered active set.
xLabels (LineChart) *string[]Category labels along the x-axis. Length should match each series.
area (LineChart)booleanfalseTOP-LEVEL prop: also fill under the line (the AREA variant), applied to every series. There is no per-series area and no legend prop: the consumer owns the selectable legend + card chrome.
bars (BarChart) *ChartBar[]Each: label, value, and a token color (a var(--color-…) string, either a categorical tint per bar or brand cyan). There is no data / colorBy prop.
showLast (Sparkline)booleantrueSparkline only: draw the filled dot at the latest point ("now"). data is number[]; color is a var(--color-…) string.
shape / value (Gauge ring)'ring'; numberThe usage ring is Gauge shape="ring" with value / max. It resolves the band internally: cyan < .60 → amber < .85 → red.
ariaLabelstringAccessible name for the figure (LineChart / BarChart). A data summary is generated when omitted.