Skip to content
All components

Components

Area chart

An area chart shows how one or more series move across the same x labels, the first series filled under its 2 px line and any others drawn as lines over it. The lines draw in, and points are ringed while a series has 31 or fewer. 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.

One series

One series over time; the fill shows the volume.

Mon: Tickets 42Tue: Tickets 51Wed: Tickets 47Thu: Tickets 63Fri: Tickets 58Sat: Tickets 31Sun: Tickets 27
ChartModel {
    kind: ChartKind::Area,
    series: vec![
        Series {
            name: "Tickets".into(),
            values: vec![42.0, 51.0, 47.0, 63.0, 58.0, 31.0, 27.0],
            hue: 1,
        },
    ],
    x_ticks: days(),
    title: Some("Tickets per day".into()),
}

Two series

Areas overlap; the legend names each.

Mon: Agents 30, People 12Tue: Agents 34, People 17Wed: Agents 33, People 14Thu: Agents 41, People 22Fri: Agents 44, People 14Sat: Agents 22, People 9Sun: Agents 20, People 7
AgentsPeople
ChartModel {
    kind: ChartKind::Area,
    series: vec![
        Series {
            name: "Agents".into(),
            values: vec![30.0, 34.0, 33.0, 41.0, 44.0, 22.0, 20.0],
            hue: 1,
        },
        Series {
            name: "People".into(),
            values: vec![12.0, 17.0, 14.0, 22.0, 14.0, 9.0, 7.0],
            hue: 2,
        },
    ],
    x_ticks: days(),
    title: Some("Resolved by".into()),
}

No data

A chart without values says so in one sentence.

No data yet

ChartModel {
    kind: ChartKind::Area,
    series: Vec::new(),
    x_ticks: Vec::new(),
    title: Some("Tickets per day".into()),
}

On the Mac

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

Area chart drawn by Ocean UI's native face, darkArea chart drawn by Ocean UI's native face, light

Use it

Web

use ocean_ui_core::chart::{ChartKind, ChartModel, Series};
let lands = Series { name: "Lands".into(), values: vec![3.0, 5.0, 4.0], hue: 1 };
ChartModel { kind: ChartKind::Area, series: vec![lands], x_ticks: vec!["Mon".into(), "Tue".into(), "Wed".into()], title: Some("Lands this week".into()) }

Native

use ocean_ui_native::{Show, charts::AreaChart, egui::Id};
AreaChart { model: &model, range_label: Some("24 h"), id: Id::unique(("gallery.chart", false)), 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—Area: the first series filled, the rest drawn as lines.
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 x 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.
  • Each x position carries a title with its label and every series' value, shown on hover over its band.
  • The axis labels are aria-hidden, the legend is the figure's figcaption, and the draw-in does not run 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