
Setting | Type | Meaning |
|---|---|---|
TreemapSeries::data | Vec<TreemapNode> | Supplies the root nodes and their nested children. |
TreemapNode::children | Vec<TreemapNode> | Describes the next level of the hierarchy. |
TreemapNode::value | f32 | Carries the node's numeric measure. |
Chart::series | Vec<Series> | Adds this hierarchy without Cartesian axes. |
use fission::charts::{Chart, TreemapSeries, TreemapNode};
let nodes = vec![TreemapNode {
name: "Application data".into(),
value: 120.0,
children: vec![
TreemapNode {
name: "Documents".into(),
value: 85.0,
children: vec![],
},
TreemapNode {
name: "Images".into(),
value: 35.0,
children: vec![],
},
],
}];
let chart = Chart::new()
.title("Stored data by class (GiB)")
.series(vec![TreemapSeries::new("Storage (GiB)")
.data(nodes)
.into()]);
use fission::prelude::*;
use fission::charts::{Chart, TreemapSeries, TreemapNode};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub StorageTreemapChart<()> {
props {
chart_title: String,
series_label: String,
nodes: Vec<TreemapNode>,
}
}
view(hierarchy, _state, _cx) =>
Chart(
title: Some(hierarchy.chart_title.clone()),
series: vec![TreemapSeries::new(&hierarchy.series_label)
.data(hierarchy.nodes.clone())
.into()],
)
}