BarChart

Grouped and stacked bars, slender with a 4px top radius and 2px gaps between stacked segments; horizontal for rankings.

View source
  • Input
  • Cache read
  • Output
  • Reasoning
Tokens by kind per day
CategoryInputCache readOutputReasoning
Oct 6840K712.5K560K382.5K
Oct 71.26M1.05M805K315K
Oct 81.08M902.5K700K472.5K
Oct 9900K760K595K405K
Oct 101.32M1.09M490K337.5K
Oct 111.14M950K735K495K
Oct 12960K807.5K630K427.5K
import { BarChart } from "@logicplanes/kaeso-ui";

Props

  • aria-label
    string

    The chart's accessible name ("Requests by model").

  • axisLabels
    string[]

    Shorter names under the bars, one per category ("3 Aug" for "Week of 3 Aug"); the tooltip, the table and screen readers keep the categories. Name the year where one begins ("Aug", "Dec", "2026", "Feb"), and pass dates: where the labels don't all fit, the axis keeps every nth, and keeps that one before the newest (axisLabelIndexes).

  • categories
    string[]

    The names along the category axis, one per bar group, in order. They also head the tooltip and the data table.

  • dates
    readonly AxisDate[]

    The day each category begins, one per category: a Date, or an ISO day ("2026-01-05"). Where the axis thins its labels, it keeps the ones where a year begins (the month after December, the first week in January), read from these, so every language keeps the same labels.

  • empty
    boolean

    Shows the empty state (emptyText) in place of the data. Pass it when the period has no data.

  • emptyText
    ReactNode

    What the empty state says. Defaults to "No data for this period" in the provider's language.

  • error
    ReactNode

    The data failed to load: the chart keeps its height, says so quietly and offers Try again. Errors are toasts, so the value isn't shown; toast the message where the request fails.

  • formatValue
    ((v: number) => string) = (v) => formatNumber(v)

    Formats values on the axis and in the tooltip.

  • height
    number = 240

    The plot's height in px (240 by default).

  • highlight
    number

    Highlight a category as the pointer does, with its tooltip: a linked view, or the states pages.

  • layout
    "horizontal" | "grouped" | "stacked" = grouped

    grouped puts each category's bars side by side (default), stacked stacks them, and horizontal draws bars across for rankings.

  • loading
    boolean

    The data is loading: the chart keeps its height and shows a quiet loading bar.

  • onRetry
    (() => void)

    Called when Try again is pressed after error; without it, the button doesn't show.

  • series
    BarSeries[]

    The bars' series, each with an id, a label, one value per category and an optional color. Colors otherwise come from the series order by id.