Bar Chart

Compare categories: grouped, stacked or sideways bars, with negative values below the line.

Tickets by status, this week.
DayOpenPendingSolved
Mon421861
Tue512258
Wed381964
Thu472552
Fri552170
Sat12815
Sun9611

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/bar-chart

Usage

import { Chart } from "./ui/uicontext/components/charts/Chart.ts"import type { ChartSeries } from "./ui/uicontext/components/charts/Data.ts"
export const TicketsByDay = <M>(h: Html.H<M>, series: ReadonlyArray<ChartSeries>) =>	Chart(h, {		props: { type: "bar", label: "Tickets by status, this week", series },		onEmit: { Highlighted: () => undefined, Selected: () => undefined, Toggled: () => undefined, RequestedRetry: () => undefined },	})

Examples

Sideways

Ranked bars with long names and values at the tips. Up and Down step through them.

Hours of use per seat, this month.
SeatHours this month
Priya Raman128 hr
Mateo Alvarez117 hr
Hana Kobayashi96 hr
Ben Okafor88 hr
Aleksandra Wiśniewska-Kowalczyk74 hr
Sam Lee31 hr
Jo4 hr

Below zero

Negative values stack down from zero, rounded at their own end.

Seats added and removed per month.
CategorySeats addedSeats removed
Jun412-120
Jul388-164
Aug455-98
Sep501-210
Oct476-142
Nov530-188

Stacked

Ninety bars, stacked, with a total in the tooltip. Labels thin out to fit.

Deploys per day, last 90 days.
DaySucceededFailed
Wed, Sep 2, 2026110
Thu, Sep 3, 202681
Fri, Sep 4, 202681
Sat, Sep 5, 202620
Sun, Sep 6, 202610
Mon, Sep 7, 2026173
Tue, Sep 8, 2026201
Wed, Sep 9, 202672
Thu, Sep 10, 2026122
Fri, Sep 11, 2026170
Sat, Sep 12, 202621
Sun, Sep 13, 202610
Mon, Sep 14, 2026143
Tue, Sep 15, 2026151
Wed, Sep 16, 2026151
Thu, Sep 17, 2026142
Fri, Sep 18, 2026110
Sat, Sep 19, 202610
Sun, Sep 20, 202600
Mon, Sep 21, 2026200
Tue, Sep 22, 2026183
Wed, Sep 23, 2026210
Thu, Sep 24, 2026190
Fri, Sep 25, 2026131
Sat, Sep 26, 202620
Sun, Sep 27, 202600
Mon, Sep 28, 2026122
Tue, Sep 29, 2026161
Wed, Sep 30, 2026112
Thu, Oct 1, 2026141
Fri, Oct 2, 2026110
Sat, Oct 3, 202600
Sun, Oct 4, 202620
Mon, Oct 5, 2026163
Tue, Oct 6, 202692
Wed, Oct 7, 2026153
Thu, Oct 8, 202692
Fri, Oct 9, 2026162
Sat, Oct 10, 202610
Sun, Oct 11, 202600
Mon, Oct 12, 2026123
Tue, Oct 13, 2026102
Wed, Oct 14, 202691
Thu, Oct 15, 2026181
Fri, Oct 16, 2026202
Sat, Oct 17, 202600
Sun, Oct 18, 202620
Mon, Oct 19, 2026202
Tue, Oct 20, 2026151
Wed, Oct 21, 2026182
Thu, Oct 22, 202691
Fri, Oct 23, 2026121
Sat, Oct 24, 202620
Sun, Oct 25, 202630
Mon, Oct 26, 2026201
Tue, Oct 27, 2026162
Wed, Oct 28, 2026141
Thu, Oct 29, 2026121
Fri, Oct 30, 2026110
Sat, Oct 31, 202600
Sun, Nov 1, 202600
Mon, Nov 2, 2026111
Tue, Nov 3, 2026171
Wed, Nov 4, 2026100
Thu, Nov 5, 2026161
Fri, Nov 6, 2026181
Sat, Nov 7, 202600
Sun, Nov 8, 202600
Mon, Nov 9, 202691
Tue, Nov 10, 2026111
Wed, Nov 11, 2026142
Thu, Nov 12, 2026121
Fri, Nov 13, 2026161
Sat, Nov 14, 202610
Sun, Nov 15, 202610
Mon, Nov 16, 2026101
Tue, Nov 17, 2026111
Wed, Nov 18, 2026133
Thu, Nov 19, 2026100
Fri, Nov 20, 2026160
Sat, Nov 21, 202600
Sun, Nov 22, 202600
Mon, Nov 23, 2026161
Tue, Nov 24, 2026151
Wed, Nov 25, 2026183
Thu, Nov 26, 2026170
Fri, Nov 27, 2026220
Sat, Nov 28, 202600
Sun, Nov 29, 202630
Mon, Nov 30, 2026162

API reference

Props

Chart props
NameTypeDefaultDescription
typerequiredChartType——
labelrequiredstring—What the chart shows, for screen readers and the table's caption: "Monthly recurring revenue"
seriesrequiredChartSeries[]——
xChartXAxis—The x axis: categories in the order given (the default), or time
formatChartFormat—How values read; a series' own format wins for it
endFormatChartFormat—A combo chart's end axis format
stacked"none" | "stacked" | "percent"—Stack areas or bars; percent shows each x as shares of 100%
horizontalboolean—Bars run sideways, categories down the side: for long names or ranked lists
curve"linear" | "smooth" | "step"——
markersboolean—A dot on every point, when there's room for them
zerobooleanTrueStart the value axis at zero; bars and areas always do. True by default
heightnumber240The plot's height in pixels, axes included; 240 by default
hiddenstring[]—Series ids to hide. Leave it out and the chart keeps track itself; pass it to own it
legendboolean—False hides the legend; it shows by default for two or more series
tableToggleboolean—False drops the View as table button; the hidden table for screen readers stays
statusChartStatus——
errorstring—What went wrong, said plainly, under "Couldn't load this chart."
emptystring—What an empty chart says: "No deploys in this period."
localestring——

Events

Chart events
EventPayloadDescription
Highlighted{ x: ChartX | null }The x being read changed, by pointer or keyboard; null when reading stops
Selected{ x: ChartX }A click, a tap or Enter on a point
Toggled{ id: string; hidden: boolean }The legend asked to hide or show a series
RequestedRetry{}—

Accessibility

  • The arrow keys step through the categories, Up and Down for sideways bars, and announce every series at that category.
  • Long category names are shortened on the axis only; the tooltip, the announcement and the table use them in full.

Source