
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("API response time by minute (ms)")
.x_axis(Axis::category(vec!["09:00", "09:01", "09:02", "09:03", "09:04", "09:05"]))
.y_axis(Axis::value())
.data_zoom(DataZoom::new().start_percent(20.0).end_percent(80.0))
.series(vec![LineSeries::new("Response time (ms)")
.data(vec![80.0, 84.0, 190.0, 240.0, 110.0, 86.0])
.into()]);
use fission::prelude::*;
use fission::charts::{Axis, Chart, DataZoom, LineSeries};
// The parent resolves display labels from its translation bundles.
fission_component! {
pub TelemetryZoomChart<()> {
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(20.0)
.end_percent(80.0)),
series: vec![LineSeries::new(&history.series_label)
.data(history.values.clone())
.into()],
)
}