(ui: &Ui, plot_ui: &PlotUi)
| 5 | use implot::{Plot, PlotText, PlotUi}; |
| 6 | |
| 7 | pub fn show_basic_plot(ui: &Ui, plot_ui: &PlotUi) { |
| 8 | ui.text(im_str!( |
| 9 | "This header just plots some text with as little code as possible." |
| 10 | )); |
| 11 | let content_width = ui.window_content_region_width(); |
| 12 | Plot::new("Simple text plot") |
| 13 | // The size call could also be omitted, though the defaults don't consider window |
| 14 | // width, which is why we're not doing so here. |
| 15 | .size([content_width, 300.0]) |
| 16 | .build(plot_ui, || { |
| 17 | // The text passed to "new" is what gets displayed. |
| 18 | let x_position: f64 = 0.5; |
| 19 | let y_position: f64 = 0.2; |
| 20 | let vertical: bool = false; |
| 21 | PlotText::new("horizontal displayed text").plot(x_position, y_position, vertical); |
| 22 | |
| 23 | // The text passed to "new" is what gets displayed. |
| 24 | let x_position: f64 = 0.2; |
| 25 | let y_position: f64 = 0.2; |
| 26 | let vertical: bool = true; |
| 27 | PlotText::new("vertical displayed text").plot(x_position, y_position, vertical); |
| 28 | }); |
| 29 | } |
| 30 | |
| 31 | pub fn show_demo_headers(ui: &Ui, plot_ui: &PlotUi) { |
| 32 | if CollapsingHeader::new(im_str!("Text plot: Basic")).build(&ui) { |
no test coverage detected