snowline 0.1.0

Iced chart library
Documentation
use iced::Length;
use snowline::line_graph::LineGraph;

fn main() {
    iced::application(App::new, App::update, App::view)
        .run()
        .unwrap();
}

#[derive(Debug)]
enum Message {}

struct App {
    data: Vec<f32>,
}

impl App {
    fn new() -> Self {
        Self {
            data: (1..11)
                .flat_map(|n| {
                    (0..100).map(move |_| rand::random_range((1.0 * n as f32)..=(10.0 * n as f32)))
                })
                .collect(),
        }
    }

    fn update(&mut self, message: Message) {
        match message {}
    }

    fn view(&self) -> iced::Element<'_, Message> {
        let text = iced::widget::text("Line Graph - Scroll to zoom, hover for values");

        let graph = LineGraph::new(self.data.clone().into_iter())
            .width(Length::Fixed(650.0))
            .height(Length::Fixed(350.0))
            .show_points(true)
            .point_radius(4.0)
            .line_width(2.5)
            .point_color_scheme(snowline::prelude::PointColorScheme::performance())
            .show_grid(true)
            .show_labels(true)
            .base_points(20.0)
            .zoom_range(0.1, 5.0);

        iced::widget::container(iced::widget::column![text, graph])
            .center(Length::Fill)
            .into()
    }
}