
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, BarSeries, Chart, ChartInteraction, ChartTooltipTrigger, Legend,
};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub GroupedTooltipChart<()> {
props {
chart_title: String,
series_label: String,
comparison_series_label: String,
category_labels: Vec<String>,
opened: Vec<f32>,
resolved: 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![
BarSeries::new(&report.series_label)
.data(report.opened.clone())
.into(),
BarSeries::new(&report.comparison_series_label)
.data(report.resolved.clone())
.into(),
],
)
}