
Field | Type | Notes |
|---|---|---|
title | &str | Names the chart for the screen, accessibility tree, and test output. |
x_axis | Axis | Usually Axis::category; use Axis::value() when x positions are numeric. |
y_axis | Axis | Uses shift categories here; the third value in each triple supplies the cell intensity. |
series | Series | Provides the typed data model for this chart family. |
width / height | f32 | Optional fixed size; omit them when the chart should flex inside Fission layout. |
use fission::charts::{Axis, Chart, HeatmapSeries, VisualMap};
let chart = Chart::new()
.title("Queued jobs by day and shift")
.x_axis(Axis::category(vec!["Mon", "Tue", "Wed"]))
.y_axis(Axis::category(vec!["AM", "PM"]))
.visual_map(VisualMap::new().min(0.0).max(10.0))
.series(vec![HeatmapSeries::new("Queued jobs")
.data(vec![
(0, 0, 3.0),
(1, 0, 8.0),
(2, 1, 5.0),
])
.into()]);
use fission::prelude::*;
use fission::charts::{Axis, Chart, HeatmapSeries, VisualMap};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub SmallMatrixHeatmapChart<()> {
props {
chart_title: String,
series_label: String,
column_labels: Vec<String>,
row_labels: Vec<String>,
queued_jobs: Vec<(usize, usize, f32)>,
}
}
view(chart, _state, _cx) =>
Chart(
title: Some(chart.chart_title.clone()),
x_axis: Some(Axis::category(
chart.column_labels.iter().map(String::as_str).collect(),
)),
y_axis: Some(Axis::category(
chart.row_labels.iter().map(String::as_str).collect(),
)),
visual_map: Some(VisualMap::new().min(0.0).max(10.0)),
series: vec![HeatmapSeries::new(&chart.series_label)
.data(chart.queued_jobs.clone())
.into()],
)
}
Area | What to decide | How to check it |
|---|---|---|
Data shape | Keep source rows in typed Rust structs, then map them into the series shown above. | Test that mapping separately from chart rendering. |
Options | Pick axes, legends, labels, motion, and interaction to answer the screen's question. | Add a screenshot test when the chart's appearance changes. |
Accessibility | Give the chart a clear title and explain important values in nearby text. Do not rely on color alone. | Inspect its semantics and check that the chart still makes sense without color. |
Failure handling | Show a loading, empty, or error state when the data is not ready. | Test empty data, partial data, and a failed fetch. |
Performance | Summarize or window very large datasets; keep the full history in your data layer. | Profile frame time and interaction latency with representative data. |