Components / ChartReference
ChartReference
A dashed line at a value that matters, with a label, over a chart.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn chart_reference() -> impl View {
Chart::new(ChartKind::Bar)
.categories(["Jan", "Feb", "Mar", "Apr", "May", "Jun"])
.series("Sales", [12.0, 18.0, 15.0, 21.0, 19.0, 24.0])
.show_value_axis()
.grid_dashed()
.value_domain(0.0, 25.0)
.tooltip(ChartTooltip::new().value_format(|value| format!("{value:.0} units")))
.reference(ChartReference::new(20.0).label("Target").color(Semantic::Warning))
.height(260.0)
}