diff --git a/examples/polyplot_mono.rs b/examples/polyplot_mono.rs deleted file mode 100644 index d767a12..0000000 --- a/examples/polyplot_mono.rs +++ /dev/null @@ -1,50 +0,0 @@ -use embedded_graphics::{ - pixelcolor::BinaryColor, - prelude::*, -}; - -use embedded_graphics_simulator::{ - SimulatorDisplay, - Window, - OutputSettingsBuilder, - BinaryColorTheme -}; - -use embedded_plots::{ - polyplot::{PolyPlot}, - curve::{PlotPoint, Curve}, -}; - -fn main() -> Result<(), core::convert::Infallible> { - let mut display: SimulatorDisplay = SimulatorDisplay::new(Size::new(128, 48)); - - let data1 = vec![ - PlotPoint { x: 0, y: 0 }, - PlotPoint { x: 1, y: 1 }, - PlotPoint { x: 2, y: 1 }, - PlotPoint { x: 3, y: 0 }, - ]; - - let data2 = vec![ - PlotPoint { x: 0, y: 1 }, - PlotPoint { x: 1, y: 0 }, - PlotPoint { x: 2, y: 3 }, - PlotPoint { x: 3, y: 2 }, - PlotPoint { x: 4, y: 2 }, - ]; - - let curves = vec![ - (Curve::from_data(data1.as_slice()), BinaryColor::On), - (Curve::from_data(data2.as_slice()), BinaryColor::On), - ]; - - let plot = PolyPlot::new(curves.as_slice(), Point { x: 10, y: 3 }, Point { x: 120, y: 45 }); - - plot.draw(&mut display)?; - let output_settings = OutputSettingsBuilder::new() - .theme(BinaryColorTheme::OledBlue) - .build(); - Window::new("Basic plot", &output_settings).show_static(&display); - - Ok(()) -} \ No newline at end of file diff --git a/examples/polyplot_rgb.rs b/examples/polyplot_rgb.rs deleted file mode 100644 index 056e3d5..0000000 --- a/examples/polyplot_rgb.rs +++ /dev/null @@ -1,49 +0,0 @@ -use embedded_graphics::{ - pixelcolor::Rgb565, - prelude::*, -}; - -use embedded_graphics_simulator::{ - SimulatorDisplay, - Window, - OutputSettingsBuilder, - -}; - -use embedded_plots::{ - polyplot::{PolyPlot}, - curve::{PlotPoint, Curve}, -}; - -fn main() -> Result<(), core::convert::Infallible> { - let mut display: SimulatorDisplay = SimulatorDisplay::new(Size::new(480, 272)); - - let data1 = vec![ - PlotPoint { x: 0, y: 0 }, - PlotPoint { x: 1, y: 1 }, - PlotPoint { x: 2, y: 1 }, - PlotPoint { x: 3, y: 0 }, - ]; - - let data2 = vec![ - PlotPoint { x: 0, y: 1 }, - PlotPoint { x: 1, y: 0 }, - PlotPoint { x: 2, y: 3 }, - PlotPoint { x: 3, y: 2 }, - PlotPoint { x: 4, y: 2 }, - ]; - - let curves = vec![ - (Curve::from_data(data1.as_slice()), RgbColor::YELLOW), - (Curve::from_data(data2.as_slice()), RgbColor::RED), - ]; - - let plot = PolyPlot::new(curves.as_slice(), Point { x: 10, y: 10 }, Point { x: 470, y: 260 }); - - plot.draw(&mut display)?; - let output_settings = OutputSettingsBuilder::new() - .build(); - Window::new("Basic plot", &output_settings).show_static(&display); - - Ok(()) -} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 3b7e2e2..7b2b50c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ pub mod curve; pub mod axis; -pub mod polyplot; pub mod single_plot; mod range_conv; \ No newline at end of file diff --git a/src/polyplot.rs b/src/polyplot.rs deleted file mode 100644 index 279d1c7..0000000 --- a/src/polyplot.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::curve::Curve; -use embedded_graphics::drawable::Drawable; -use embedded_graphics::DrawTarget; -use embedded_graphics::prelude::Point; -use embedded_graphics::pixelcolor::PixelColor; - -pub struct PolyPlot<'a, C> -{ - curves: &'a [(Curve<'a>, C)], - top_left: Point, - bottom_right: Point, -} - -impl<'a, C> PolyPlot<'a, C> - where - C: PixelColor -{ - pub fn new(curves: &'a [(Curve<'a>, C)], top_left: Point, bottom_right: Point) -> PolyPlot { - PolyPlot { curves, top_left, bottom_right } - } -} - -impl<'a, C> Drawable for PolyPlot<'a, C> - where - C: PixelColor + Default, -{ - fn draw>(self, display: &mut D) -> Result<(), D::Error> { - for (curve, color) in self.curves { - curve.into_drawable_curve( - &self.top_left, - &self.bottom_right, - ).set_color(*color) - .set_thickness(2) - .draw(display)?; - } - Ok(()) - } -} \ No newline at end of file