Activity chart
A small chart of activity over a span, a day by default, that leads to a log: thin bars on a baseline, and a tooltip that follows the pointer from bar to bar.
<Card> <CardHeader> <CardTitle badges={<Badge color="neutral" size="md">Last 24 hours</Badge>}>Tool calls</CardTitle> <CardAction><Button size="sm">View audit history</Button></CardAction> </CardHeader> <CardContent className="px-card-inset py-card-inset-text"> <ActivityChart label="Tool calls evaluated, last 24 hours" series={[{ label: "Allowed" }, { label: "Denied" }]} data={points} /> </CardContent></Card>Installation
import { ActivityChart } from "@dome-systems/ds-dashboard/components";Two series
The first series is the bar, in the design system's blue; the second is capped on it, 2px above, in its red. The colors are the design system's, in light and dark: a screen names its series and does not pick their colors. Under the pointer the tooltip gives the bar's range, each series beside its Status dot, a rule, and the total. A cap is never thinner than 4px: it takes that from the bar under it, so the bar's height stays true.
<ActivityChart label="Tool calls evaluated, last 24 hours" series={[{ label: "Allowed" }, { label: "Denied" }]} data={points}/>One series
One series is a plain bar, in the blue. The tooltip gives its range and its count: no rule, no total.
<ActivityChart label="Model calls, last 24 hours" series={[{ label: "Calls" }]} data={points} />A quiet stretch
A bar with nothing is a 4px stub in the neutral fill, so a quiet night still reads as time that passed. Its tooltip says 0.
<ActivityChart label="Tool calls evaluated, last 24 hours" series={series} data={points} />Nothing yet
With no counts at all the chart is a row of stubs over the span: time passed, nothing happened.
<ActivityChart label="Tool calls evaluated, last 24 hours" series={series} data={[]} />The width sets the bars
A bar stays about 10px wide, 3px apart, and the bars always run from the start time to “Now”. To keep them that wide, the chart decides how many minutes each bar stands for from how wide it is: a wider chart gets more bars, each standing for less time, never wider bars. Here, the same day at 880px and at 480px.
<div className="w-[480px]"> <ActivityChart label="Tool calls evaluated, last 24 hours" series={series} data={points} /></div>Without the tooltip
With tooltip off the bars are a picture alone, for a place that already gives the numbers beside the chart.
<ActivityChart label="Tool calls evaluated, last 24 hours" series={series} data={points} tooltip={false} />What it is not
It is a glance at recent activity, there to send someone to the log that holds the details (the audit history, a run list). It is not a chart to read values from: one row of bars, one or two series, no axes, no legend, no zoom. A number with its lines over time, a scale and a legend is the Metric card. A screen that needs to pick a range or zoom needs a chart the design system does not have yet.
It draws no box and no numbers of its own: a Card holds it, and the numbers and the way to the log are the Card's, as on the hero above.
In the dashboard
The Tools page's Tool calls card (components/tools/tools-activity.tsx): the last 24 hours of tool calls the rules decided on, allowed under denied, from the summary's minute buckets. A Status dot after the words Allowed and Denied, in the card's numbers, names each series in its bars' color (ACTIVITY_CHART_COLORS).
Accessibility
With the tooltip, the bars are one tab stop, announced as an interactive chart (role="slider") named by label, how long a bar stands for, and each series' total (“Tool calls evaluated, last 24 hours, every 15 minutes: 4,372 allowed, 116 denied”). Keyboard focus opens the tooltip on the last bar, with the focus ring; the left and right arrows move a bar, Home and End go to the ends, Escape closes it. Each bar is read as a sentence (“08:20 to 08:40: 82 allowed, 1 denied”, “so far” on the bar still filling). Without the tooltip, the bars are one image with the same name.
A finger on the bars opens the tooltip and drags it from bar to bar; a vertical swipe still scrolls the page.
Each series is told by its color and by its name beside its dot in the tooltip, never by color alone. In high contrast (forced colors) the bars take the system's text color, a cap its highlight, and the baseline stays. Under reduced motion the tooltip does not slide and the counts change in place.
API Reference
Besides these, the props of a <div> (className, aria-*…).
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Required. What the bars count, said to a screen reader with each series' total. |
series | [{ label }] | [{ label }, { label }] | — | Required. One or two, bottom first, each named by its label in the tooltip. Their colors are the design system's: the first is the blue, a second the red. |
data | { at: number; values: number[] }[] | — | Required. The counts at any grain (a minute, an hour), one per series, each added to the bar its time falls in. |
span | number | a day | How much time the chart shows, in ms: the last 6 hours, 12, a day. |
end | number | now | When that time ends, in ms. Left out, it is now, and the last label says “Now”. |
steps | number[] | 1 to 60 minutes | The lengths of time one bar may stand for, in minutes. The chart takes the one that keeps its bars about 10px wide; leave it out unless the data only comes at a coarser grain. |
barWidth | { min: number; ideal: number; max: number } | { 8, 10, 12 } | How wide a bar may be, in px, and the width it aims for. The bars always fill the chart: this decides how many there are, not where they end. |
tooltip | boolean | true | The tooltip that follows the pointer over the bars. |
Rules
Written down
Bars keep their width, and run from the start to Now
A bar is about 10px wide, 8 to 12, 3px apart. A wider chart, or a shorter span, gets more bars, each standing for less time, never wider bars. The bars share the chart's width, so the first is under the start time and the last under “Now”.
From ds/README.md (Activity chart) and ds/lib/activity-chart.ts.
A cap is 4px at least, and a bar with nothing is a 4px stub
The cap takes its floor from the bar under it, so the bar's whole height stays true. A stub is the neutral fill, and its tooltip says 0.
From ds/README.md (Activity chart) and ds/lib/activity-chart.ts.
One tooltip for the whole chart
It opens beside the bar under the pointer, a finger or the keyboard, to its right (to its left on the last bars), its top level with the chart's, and slides to the next bar without closing. Where neither side has room (a phone), it slides to stay inside the chart. It closes 120ms after the pointer leaves the chart.
From ds/README.md (Activity chart) and ds/components/activity-chart.tsx.
The start and the end always stand under the bars
The span's start time against the left edge, “Now” (or the end) against the right; between them, round hours every 1, 2, 3, 6 or 12 hours, the finest that stays 12px clear of every other label, eight at most. All at 10px (text-body-5).
From ds/lib/activity-chart.ts (activityChartTicks).
The bar still filling is lighter
The last bar holds the span's end, so it is drawn at 45% and its tooltip says “so far”: it does not read as a dip.
From ds/components/activity-chart.tsx.
The other bars fade a little
While a bar is pointed at, it keeps its hover fill and every other bar goes to 90%.
From ds/components/activity-chart.tsx.
The colors are the design system's
The first series is the blue, a second the red, in light and dark, drawn with the Status dot's own fill so the dot beside a name in the tooltip is always its bars' color. A screen does not pick them; another pairing is added to the component when one is needed. A dot that names a series beside the chart takes ACTIVITY_CHART_COLORS, in the series' order.
From ds/components/activity-chart.tsx.