1use fltk::{prelude::*, *};
2
3fn main() {
4 let app = app::App::default().with_scheme(app::Scheme::Gtk);
5 let mut win = window::Window::new(100, 100, 800, 600, "Charts");
6 let mut chart = misc::Chart::default().size_of_parent();
7 chart.set_type(misc::ChartType::Pie);
8 chart.set_bounds(0.0, 100.0);
9 chart.set_text_size(18);
10 chart.add(88.4, "Rust", enums::Color::from_u32(0xcc9c59));
11 chart.add(8.4, "C++", enums::Color::Red);
12 chart.add(3.2, "C", enums::Color::Black);
13 chart.set_color(enums::Color::White);
14 let mut choice = menu::Choice::new(300, 5, 200, 40, "Chart type");
15 choice.add_choice("Bar|HorzBar|Line|Fill|Spike|Pie|SpecialPie");
16 choice.set_value(5);
17 choice.set_color(enums::Color::White);
18 win.end();
19 win.show();
20
21 choice.set_callback(move |c| {
22 chart.set_type(misc::ChartType::from_i32(c.value()));
23 chart.redraw();
24 });
25
26 app.run().unwrap();
27}