| 27 | } |
| 28 | |
| 29 | pub fn show_basic_plot(ui: &Ui, plot_ui: &PlotUi) { |
| 30 | ui.text(im_str!( |
| 31 | "This header just plots a line with as little code as possible." |
| 32 | )); |
| 33 | let content_width = ui.window_content_region_width(); |
| 34 | Plot::new("Simple line plot") |
| 35 | // The size call could also be omitted, though the defaults don't consider window |
| 36 | // width, which is why we're not doing so here. |
| 37 | .size([content_width, 300.0]) |
| 38 | .build(plot_ui, || { |
| 39 | // If this is called outside a plot build callback, the program will panic. |
| 40 | let x_positions = vec![0.1, 0.9]; |
| 41 | let y_positions = vec![0.1, 0.9]; |
| 42 | PlotLine::new("legend label").plot(&x_positions, &y_positions); |
| 43 | }); |
| 44 | } |
| 45 | |
| 46 | pub fn show_two_yaxis_plot(ui: &Ui, plot_ui: &PlotUi) { |
| 47 | ui.text(im_str!( |