Spark Bars

View as Markdown

Counts per day or week as word-sized columns, the latest in full color.

ServiceLast 14 daysDeploysFailed
api-gateway411
billing-worker60
search-indexer423

When to use

Counts per day or week as word-sized columns, the latest in full color. Use Bar Chart instead when the values need axes and labels.

Usage

import { SparkBars } from "./ui/uicontext/components/charts/SparkBars.ts"
export const Deploys = <M>(h: Html.H<M>) => SparkBars(h, { label: "Deploys, last 14 days", values: [3, 5, 2, 0, 0, 4, 6, 3, 7, 2, 0, 0, 5, 4] })

Examples

Across a stat card

width: "fill" takes the card's width; hours still to come are null. highlight picks out the busiest.

Signups today

427

Busiest at 13:00 · 51 signups

API reference

Options

SparkBars options
NameTypeDefaultDescription
valuesrequiredReadonlyArray<number | null>—One number per period, oldest first; null for a period with no data.
labelrequiredstring—What it shows, for its accessible name: "Deploys, last 14 days".
formatChartFormat——
widthnumber | "fill"96Pixels, or "fill" to take its container's width. 96 by default.
heightnumber24Pixels; 24 by default.
highlightnumber—The column in full color; the last by default, -1 for all of them.
colorChartColor——
localestring——
styleStyle——

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/spark-bars

Source