Skip to content
All components

Components

Bar chart

A bar chart compares values across bands, one band per x label, with each series' bar side by side in the band's middle 64 percent. The bars grow from the baseline as the chart appears, and the x labels sit one per band and wrap inside it. Each series takes one of the theme's five chart hues; a legend appears for two series or more, and a chart with no values says No data yet.

Per category

Counts per category, at most sixteen on an axis.

Models: Spend 820Search: Spend 640Storage: Spend 1.2kEmail: Spend 380
ChartModel {
    kind: ChartKind::Bar,
    series: vec![
        Series {
            name: "Spend".into(),
            values: vec![820.0, 640.0, 1210.0, 380.0],
            hue: 3,
        },
    ],
    x_ticks: ["Models", "Search", "Storage", "Email"].map(String::from).to_vec(),
    title: Some("Spend by service".into()),
}

Grouped

Two series side by side per category.

08:00: Closed 31, Handed off 409:00: Closed 44, Handed off 610:00: Closed 52, Handed off 308:00: Closed 31, Handed off 409:00: Closed 44, Handed off 610:00: Closed 52, Handed off 3
ClosedHanded off
ChartModel {
    kind: ChartKind::Bar,
    series: vec![
        Series { name: "Closed".into(), values: vec![31.0, 44.0, 52.0], hue: 1 },
        Series { name: "Handed off".into(), values: vec![4.0, 6.0, 3.0], hue: 2 },
    ],
    x_ticks: ["08:00", "09:00", "10:00"].map(String::from).to_vec(),
    title: Some("Closed per hour".into()),
}

Per day

A week of counts.

Mon: Runs 120Tue: Runs 140Wed: Runs 132Thu: Runs 160Fri: Runs 151Sat: Runs 60Sun: Runs 48
ChartModel {
    kind: ChartKind::Bar,
    series: vec![
        Series {
            name: "Runs".into(),
            values: vec![120.0, 140.0, 132.0, 160.0, 151.0, 60.0, 48.0],
            hue: 1,
        },
    ],
    x_ticks: days(),
    title: Some("Agent runs per day".into()),
}

On the Mac

The same vocabulary drawn by Ocean UI's native face (egui on Metal), as the gallery's snapshot.

Bar chart drawn by Ocean UI's native face, darkBar chart drawn by Ocean UI's native face, light

Use it

Web

use ocean_ui_core::chart::{ChartKind, ChartModel, Series};
let deploys = Series { name: "Deploys".into(), values: vec![4.0, 7.0, 3.0], hue: 2 };
ChartModel { kind: ChartKind::Bar, series: vec![deploys], x_ticks: vec!["Mon".into(), "Tue".into(), "Wed".into()], title: Some("Deploys per day".into()) }

Native

use ocean_ui_native::{Show, charts::BarChart, egui::Id};
BarChart { model: &model, range_label: None, id: Id::unique("gallery.bar"), height: 220.0 }.show(ui)

Cargo feature charts of ocean-ui-core, ocean-ui-web and ocean-ui-native; available since 2026-10-29.

In App UI, the chart block draws it from YAML.

Props

NameTypeDefaultWhat
kindChartKind—Bar: the series side by side in each band.
seriesVec<Series>—The runs of values, each a Series { name, values: Vec<f64>, hue: u8 } whose hue 1 to 5 picks a chart colour.
x_ticksVec<String>—The band labels, one per value; a missing one shows its position, counted from 1.
titleOption<String>NoneThe chart's accessible name, Chart when absent.

Accessibility

  • The SVG is role="img" with the title as its aria-label, or Chart when there is none, so give every chart a title.
  • Every bar carries a title with its x label and every series' value, shown on hover.
  • The axis labels are aria-hidden, the legend is the figure's figcaption, and the bars do not grow under reduced motion.

Related

Markdown

The same page as Markdown, for an agent or a pull request.

Search

esc

Components

Blocks

Screens built from blocks

The Ocean app

Ocean Base console