Plot a line. Use this in closures passed to [`Plot::build()`](struct.Plot.html#method.build)
(&self, x: &[f64], y: &[f64])
| 26 | |
| 27 | /// Plot a line. Use this in closures passed to [`Plot::build()`](struct.Plot.html#method.build) |
| 28 | pub fn plot(&self, x: &[f64], y: &[f64]) { |
| 29 | // If there is no data to plot, we stop here |
| 30 | if x.len().min(y.len()) == 0 { |
| 31 | return; |
| 32 | } |
| 33 | unsafe { |
| 34 | sys::ImPlot_PlotLinedoublePtrdoublePtr( |
| 35 | im_str!("{}", self.label).as_ptr() as *const c_char, |
| 36 | x.as_ptr(), |
| 37 | y.as_ptr(), |
| 38 | x.len().min(y.len()) as i32, // "as" casts saturate as of Rust 1.45. This is safe here. |
| 39 | 0, // No offset |
| 40 | std::mem::size_of::<f64>() as i32, // Stride, set to one f64 for the standard use case |
| 41 | ); |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /// Struct to provide functionality for plotting a line in a plot with stairs style. |
no outgoing calls
no test coverage detected