
Setting | Type | Meaning |
|---|---|---|
ChartInteraction::tooltips | ChartTooltipTrigger | Chooses item-level or common-axis feedback. |
ChartInteraction::keyboard_focus | bool | Enables focusable chart navigation. |
Chart::interaction | ChartInteraction | Installs the configured behaviour. |
use fission::prelude::*;
use fission::charts::{
Axis, Chart, ChartInteraction, ChartTooltipTrigger, Legend, LineSeries,
};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub AxisTooltipChart<()> {
props {
chart_title: String,
series_label: String,
comparison_series_label: String,
category_labels: Vec<String>,
delivery: Vec<f32>,
collection: Vec<f32>,
}
}
view(report, _state, _cx) =>
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()),
legend: Some(Legend::top_right()),
interaction: ChartInteraction::tooltips(ChartTooltipTrigger::Axis)
.keyboard_focus(true),
series: vec![
LineSeries::new(&report.series_label)
.data(report.delivery.clone())
.into(),
LineSeries::new(&report.comparison_series_label)
.data(report.collection.clone())
.into(),
],
)
}