Graphic note

A graphic note keeps a short explanation in the same chart model as the values it describes. It is useful for a report where a reader needs to know that the collection method or reporting period changed. The screenshot is from Fission's chart gallery.

What the chart is for

Keep this note brief. A chart is not a reliable container for a paragraph, particularly after resizing or translation. Put the full explanation in normal text outside the chart and use the note as a concise reference to it.

Data model

The note uses plot-relative x, y, width and height. Set the text bounds explicitly so they use the same fractional units as the renderer. Counts and the already-resolved note are props; the component reads its text colour from the active theme.

Rust API

Setting
Type
Meaning
ChartGraphic::text
Constructor
Creates a text graphic from a position, string and colour.
ChartGraphic::rect
Constructor
Creates a plot-relative rectangular graphic.
ChartGraphic::line
Constructor
Creates a line from a plot-relative position and extent.
Chart::graphics field
Vec<ChartGraphic>
Supplies the overlay graphics.

Authoring from a Fission component

This component receives prepared data and a note. The short series has a fixed reporting week; change the labels alongside the values when the period changes.
use fission::prelude::*;
use fission::charts::{Axis, Chart, ChartGraphic, LineSeries};

// The parent resolves display labels from its translation bundles.
fission_component! {
    pub GraphicNoteChart<()> {
        props {
            chart_title: String,
            series_label: String,
            category_labels: Vec<String>,
            values: Vec<f32>,
            note: String,
        }
    }
    view(report, _state, cx) {
        let colors = &cx.view.env().theme.tokens.colors;
        let note = ChartGraphic {
            width: 0.65,
            height: 0.12,
            ..ChartGraphic::text(0.05, 0.05, report.note.clone(), colors.text_primary)
        };
        let graphics = vec![note];
    } =>
        Chart(
            title: Some(report.chart_title.clone()),
            x_axis: Some(Axis::category(
                report.category_labels.iter().map(String::as_str).collect(),
            )),
            y_axis: Some(Axis::value()),
            graphics: graphics,
            series: vec![LineSeries::new(&report.series_label)
                .data(report.values.clone())
                .into()],
        )
}

Testing and accessibility

Check text contrast and clipping in both themes and at mobile width. Keep the explanation available as ordinary accessible text as well; a painted annotation should not be the only place essential context exists.
Tags: graphic, annotation.