Cleaned up examples code more.

This commit is contained in:
4bb4 2020-09-13 16:11:57 +02:00
parent 03f9fefba7
commit 9814e86d64
2 changed files with 6 additions and 5 deletions

View file

@ -2,7 +2,7 @@
//! features of the libray, see the line_plots example. //! features of the libray, see the line_plots example.
use imgui::{im_str, CollapsingHeader, Condition, Ui, Window}; use imgui::{im_str, CollapsingHeader, Condition, Ui, Window};
use implot::{push_style_var_f32, push_style_var_u32, Marker, Plot, PlotBars, StyleVar}; use implot::{Plot, PlotBars};
mod support; mod support;
@ -45,7 +45,7 @@ fn main() {
let system = support::init(file!()); let system = support::init(file!());
let mut showing_demo = false; let mut showing_demo = false;
system.main_loop(move |_, ui| { system.main_loop(move |_, ui| {
Window::new(im_str!("Line plots example")) Window::new(im_str!("Bar plots example"))
.size([430.0, 450.0], Condition::FirstUseEver) .size([430.0, 450.0], Condition::FirstUseEver)
.build(ui, || { .build(ui, || {
ui.text(im_str!("Hello from implot-rs!")); ui.text(im_str!("Hello from implot-rs!"));

View file

@ -25,7 +25,7 @@ fn show_basic_plot(ui: &Ui) {
fn show_custom_markers_plot(ui: &Ui) { fn show_custom_markers_plot(ui: &Ui) {
ui.text(im_str!( ui.text(im_str!(
"This header just plots a line with as little code as possible." "This header shows how markers can be used in scatter plots."
)); ));
let content_width = ui.window_content_region_width(); let content_width = ui.window_content_region_width();
Plot::new("Simple scatter plot") Plot::new("Simple scatter plot")
@ -47,7 +47,8 @@ fn show_custom_markers_plot(ui: &Ui) {
let marker_size = push_style_var_f32(&StyleVar::MarkerSize, 12.0); let marker_size = push_style_var_f32(&StyleVar::MarkerSize, 12.0);
PlotScatter::new("legend label 2").plot(&x_positions, &y_positions); PlotScatter::new("legend label 2").plot(&x_positions, &y_positions);
// TODO(4bb4) check if these have to be in reverse push order // TODO(4bb4) check if these have to be in reverse push order. Does not
// seem to be the case.
marker_size.pop(); marker_size.pop();
marker_choice.pop(); marker_choice.pop();
}); });
@ -57,7 +58,7 @@ fn main() {
let system = support::init(file!()); let system = support::init(file!());
let mut showing_demo = false; let mut showing_demo = false;
system.main_loop(move |_, ui| { system.main_loop(move |_, ui| {
Window::new(im_str!("Line plots example")) Window::new(im_str!("Scatter plots example"))
.size([430.0, 450.0], Condition::FirstUseEver) .size([430.0, 450.0], Condition::FirstUseEver)
.build(ui, || { .build(ui, || {
ui.text(im_str!("Hello from implot-rs!")); ui.text(im_str!("Hello from implot-rs!"));