
Field | Type | Notes |
|---|---|---|
title | &str | Names the chart for the screen, accessibility tree, and test output. |
x_axis / y_axis | Axis | Vertical bars use category x/value y; horizontal bars use value x/category y. |
series | BarSeries | Holds values plus stack, orientation, radius, background, and color styling. |
width / height | f32 | Optional fixed size; omit them when the chart should flex inside Fission layout. |
use fission::charts::{Axis, BarSeries, Chart};
use fission::core::op::Color;
let chart = Chart::new()
.title("Rounded bar with background")
.x_axis(Axis::category(vec!["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]))
.y_axis(Axis::value().max(260.0))
.series(vec![BarSeries::new("Traffic")
.border_radius(10.0)
.background(Color { r: 226, g: 232, b: 240, a: 150 })
.data(vec![120.0, 200.0, 150.0, 80.0, 70.0, 110.0, 130.0])
.into()]);
use fission::prelude::*;
use fission::charts::{Axis, BarSeries, Chart};
use fission::core::op::Color;
pub struct BarWithBackgroundChart;
impl From<BarWithBackgroundChart> for Widget {
fn from(_: BarWithBackgroundChart) -> Widget {
Chart::new()
.title("Rounded bar with background")
.x_axis(Axis::category(vec!["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]))
.y_axis(Axis::value().max(260.0))
.series(vec![BarSeries::new("Traffic")
.border_radius(10.0)
.background(Color { r: 226, g: 232, b: 240, a: 150 })
.data(vec![120.0, 200.0, 150.0, 80.0, 70.0, 110.0, 130.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. |