embedded-plots/examples/basic-plot/main.rs

25 lines
683 B
Rust
Raw Normal View History

2020-12-17 23:23:15 +00:00
use embedded_graphics::{
pixelcolor::Rgb565,
prelude::*,
};
use embedded_graphics_simulator::{SimulatorDisplay, Window, OutputSettingsBuilder};
use embedded_plots::Plot;
fn main() -> Result<(), core::convert::Infallible> {
let mut display: SimulatorDisplay<Rgb565> = SimulatorDisplay::new(Size::new(480, 272));
2020-12-17 23:32:58 +00:00
let data = vec![
Point::new(100, 100),
Point::new(150, 100),
Point::new(200, 200)];
Plot::new(data.as_slice()
,RgbColor::GREEN)
2020-12-17 23:23:15 +00:00
.draw(&mut display)?;
let output_settings = OutputSettingsBuilder::new()
.build();
Window::new("Hello World", &output_settings).show_static(&display);
Ok(())
2020-12-17 21:45:34 +00:00
}