(ui: &Ui, plot_ui: &PlotUi)
| 5 | use implot::{Plot, PlotStems, PlotUi}; |
| 6 | |
| 7 | pub fn show_basic_plot(ui: &Ui, plot_ui: &PlotUi) { |
| 8 | ui.text(im_str!("This header shows a simple stem plot.")); |
| 9 | let content_width = ui.window_content_region_width(); |
| 10 | Plot::new("Stem plot") |
| 11 | // The size call could also be omitted, though the defaults don't consider window |
| 12 | // width, which is why we're not doing so here. |
| 13 | .size([content_width, 300.0]) |
| 14 | .build(plot_ui, || { |
| 15 | // If this is called outside a plot build callback, the program will panic. |
| 16 | let axis_positions = vec![0.2, 0.4, 0.6, 0.8, 0.9, 0.93]; |
| 17 | let values = vec![0.1, 0.2, 0.3, 0.4, 0.3, 0.8]; |
| 18 | PlotStems::new("legend label") |
| 19 | .with_reference_y(0.1) |
| 20 | .plot(&axis_positions, &values); |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | pub fn show_demo_headers(ui: &Ui, plot_ui: &PlotUi) { |
| 25 | if CollapsingHeader::new(im_str!("Stem plots")).build(&ui) { |
no test coverage detected