
Setting | Type | Meaning |
|---|---|---|
Chart::x_axis | Axis | Supplies the column categories. |
Chart::y_axis | Axis | Supplies the row categories, not the cell-value range. |
HeatmapSeries::data | Vec<(usize, usize, f32)> | Supplies the indexed cells and their values. |
Chart::visual_map | VisualMap | Sets the numeric range used for colour. |
use fission::charts::{Axis, Chart, HeatmapSeries, VisualMap};
let chart = Chart::new()
.title("Users of each feature by plan")
.x_axis(Axis::category(vec!["Search", "Export", "Sharing"]))
.y_axis(Axis::category(vec!["Starter", "Team"]))
.visual_map(VisualMap::new().min(0.0).max(100.0))
.series(vec![HeatmapSeries::new("Distinct users")
.data(vec![
(0, 0, 73.0),
(1, 0, 12.0),
(2, 0, 27.0),
(0, 1, 84.0),
(1, 1, 61.0),
(2, 1, 79.0),
])
.into()]);
use fission::prelude::*;
use fission::charts::{Axis, Chart, HeatmapSeries, VisualMap};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub FeatureUsageHeatmapChart<()> {
props {
chart_title: String,
series_label: String,
column_labels: Vec<String>,
row_labels: Vec<String>,
samples: 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(100.0)),
series: vec![HeatmapSeries::new(&chart.series_label)
.data(chart.samples.clone())
.into()],
)
}