
Field | Type | Notes |
|---|---|---|
title | &str | Names the chart for the screen, accessibility tree, and test output. |
mark_point | MarkPoint | Annotates a named data point. |
mark_line | MarkLine | Draws a threshold or target line. |
mark_area | MarkArea | Highlights a value band. |
width / height | f32 | Optional fixed size; omit them when the chart should flex inside Fission layout. |
use fission::charts::{Axis, Chart, LineSeries, MarkArea, MarkLine, MarkPoint};
let chart = Chart::new()
.title("Markers and target band")
.x_axis(Axis::category(vec!["Jan", "Feb", "Mar", "Apr", "May", "Jun"]))
.y_axis(Axis::value())
.mark_area(MarkArea::y_range("Target band", 120.0, 190.0))
.mark_line(MarkLine::y("Target", 160.0))
.mark_point(MarkPoint::xy("Peak", 4.0, 230.0))
.series(vec![LineSeries::new("Revenue").data(vec![80.0, 132.0, 101.0, 184.0, 230.0, 210.0]).into()]);
use fission::prelude::*;
use fission::charts::{Axis, Chart, LineSeries, MarkArea, MarkLine, MarkPoint};
pub struct MarkLineAndPointChart;
impl From<MarkLineAndPointChart> for Widget {
fn from(_: MarkLineAndPointChart) -> Widget {
Chart::new()
.title("Markers and target band")
.x_axis(Axis::category(vec!["Jan", "Feb", "Mar", "Apr", "May", "Jun"]))
.y_axis(Axis::value())
.mark_area(MarkArea::y_range("Target band", 120.0, 190.0))
.mark_line(MarkLine::y("Target", 160.0))
.mark_point(MarkPoint::xy("Peak", 4.0, 230.0))
.series(vec![LineSeries::new("Revenue").data(vec![80.0, 132.0, 101.0, 184.0, 230.0, 210.0]).into()])
.into()
}
}
Area | What to decide | How to verify |
|---|---|---|
Data shape | Keep source rows in typed Rust structs, then map them into the series type shown in the example. | Unit test the mapping separately from rendering. |
Options | Choose axes, legends, labels, animation, and interaction based on the user's task. | Add a screenshot test when changing visual behavior. |
Accessibility | Provide a clear title and adjacent summary text for important trends or outliers. | Inspect the generated semantics and make sure the chart is understandable without color alone. |
Failure handling | Render an empty, loading, or error state before constructing the chart if data is unavailable. | Test empty data, partial data, and failed fetches. |
Performance | Prefer summarized or windowed data for very large datasets; keep full raw history in the data layer. | Profile frame time and interaction latency with representative data volumes. |