Skip to content
All components

Components

Line chart

A line chart shows how one or more series move across the same x labels, each as a 2 px line that draws in, with ringed points while a series has 31 or fewer. It is the area chart without the fill; on the native face the same AreaChart draws both. 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.

Two series

Lines compare series without filling under them.

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::Line,
    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()),
}

One series

A single trend over the week.

Mon: First reply (min) 6Tue: First reply (min) 5Wed: First reply (min) 5.5Thu: First reply (min) 4Fri: First reply (min) 4.5Sat: First reply (min) 3Sun: First reply (min) 3.5
ChartModel {
    kind: ChartKind::Line,
    series: vec![
        Series {
            name: "First reply (min)".into(),
            values: vec![6.0, 5.0, 5.5, 4.0, 4.5, 3.0, 3.5],
            hue: 3,
        },
    ],
    x_ticks: days(),
    title: Some("Median first reply".into()),
}

Three series

Hues one to five pick the theme's chart colours.

Mon: Email 20, Chat 10, Phone 5Tue: Email 24, Chat 12, Phone 6Wed: Email 22, Chat 15, Phone 4Thu: Email 30, Chat 13, Phone 7Fri: Email 28, Chat 18, Phone 6Sat: Email 14, Chat 9, Phone 2Sun: Email 12, Chat 8, Phone 1
EmailChatPhone
ChartModel {
    kind: ChartKind::Line,
    series: vec![
        Series {
            name: "Email".into(),
            values: vec![20.0, 24.0, 22.0, 30.0, 28.0, 14.0, 12.0],
            hue: 1,
        },
        Series {
            name: "Chat".into(),
            values: vec![10.0, 12.0, 15.0, 13.0, 18.0, 9.0, 8.0],
            hue: 2,
        },
        Series {
            name: "Phone".into(),
            values: vec![5.0, 6.0, 4.0, 7.0, 6.0, 2.0, 1.0],
            hue: 3,
        },
    ],
    x_ticks: days(),
    title: Some("Tickets by channel".into()),
}

On the Mac

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

Line chart drawn by Ocean UI's native face, darkLine 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::Line, 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", true)), 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—Line: every series a line, none filled.
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