amenui
en·中 github ↗ v0.0.1
01docs 02components 03lab 04works
en·中github ↗
×

docs / components / data / dot chart docs / components / data /

dot chart

04.40
On this page ▾
  1. Installation
  2. Usage
  3. API
  4. Keyboard and accessibility

A series as a field of dots: each column filled from the axis up to the curve, a dot's size and brightness saying how much of it lies under the curve (the area reads as the area under it); a range in the accent colour; a scrubbing marker with the value; control points on the axis that drag the curve live.

Labels in the mono (pixel) face.

drawn by amenuiopen ↗

Installation

Components are distributed as source. Copy it and what it depends on into your project, then change it as you need:

sh
cargo run --release --bin amenui -- add dot_chart --to ../my-app

Files copied: src/widgets/dot_chart.rs, src/widgets/mod.rs

Usage

rust
use amenui::widgets::{dot_chart};

fn view() -> El<Msg> {
    let mut c = DotChart::default();
    (c.cols, c.rows, c.pitch) = (28, 10, 7.0);
    dot_chart("dc1", &c, Msg::Chart)
}

API

Functionsdot_chart
Propskey, chart (DotChart: knots, cols, rows, pitch, range, max, unit), msg.
Filessrc/widgets/dot_chart.rs
Depends onbase
Response to frontsnudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap)
Recompositionthe value label does not recompose (it follows the pointer)

Keyboard and accessibility

Statesrest, scrubbing (a marker and a label at the column under the pointer), dragging a control point (captured until release); focused, Left / Right move the marker, Up / Down change the control point nearest to it.
Keys and messagesmsg(ChartMsg) for pointer moves, drags of control points and keys; the application calls DotChart::update with it.

On the web every control is mirrored into the page as an element with its role and name, so screen readers and the browser's own focus see it (DESIGN.md §1.14).

Recipes: A dot chart