
Setting | Type | Meaning |
|---|---|---|
Chart::data_zoom | DataZoom | Adds the initial visible range. |
DataZoom::start_percent | f32 | Sets the start of the ordered window. |
DataZoom::end_percent | f32 | Sets the end of the ordered window. |
DataZoom::zoom_type | DataZoomType | Chooses slider or inside-plot interaction. |
use fission::charts::{Axis, Chart, DataZoom, LineSeries};
let chart = Chart::new()
.title("Daily completed orders")
.x_axis(Axis::category(vec!["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]))
.y_axis(Axis::value())
.data_zoom(DataZoom::new().start_percent(25.0).end_percent(75.0))
.series(vec![LineSeries::new("Completed orders")
.data(vec![42.0, 51.0, 47.0, 63.0, 71.0, 85.0, 68.0])
.into()]);
use fission::prelude::*;
use fission::charts::{Axis, Chart, DataZoom, LineSeries};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub DataZoomOverviewChart<()> {
props {
chart_title: String,
series_label: String,
category_labels: Vec<String>,
values: Vec<f32>,
}
}
view(history, _state, _cx) =>
Chart(
title: Some(history.chart_title.clone()),
x_axis: Some(Axis::category(
history.category_labels.iter().map(String::as_str).collect(),
)),
y_axis: Some(Axis::value()),
data_zoom: Some(DataZoom::new()
.start_percent(25.0)
.end_percent(75.0)),
series: vec![LineSeries::new(&history.series_label)
.data(history.values.clone())
.into()],
)
}