1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
mod axis;
mod axis_options;
mod chart;
mod curve;
pub use chart::Chart;
pub use curve::{Curve, CurveData};
use crate::geometry::Size;
use crate::render::Canvas;
use crate::render::draw_chart;
pub fn plot(canvas: &mut dyn Canvas, x: Vec<f64>, y: Vec<f64>, size: Size) {
info!("Plotting len(x)= {:?} len(y)= {:?}", x.len(), y.len());
let mut chart = Chart::default();
chart.set_xlabel("Time");
chart.set_ylabel("Value");
chart.set_title("W00tie");
let curve_data = CurveData::points(x, y);
let curve = Curve::new(curve_data);
chart.add_curve(curve);
chart.autoscale();
draw_chart(&chart, canvas, size);
}