1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Assign default colors to plot lines if not explicitly set

This commit is contained in:
Emil Ernerfeldt
2021-02-18 18:59:59 +01:00
parent a19140ec67
commit 0f13fff24b
2 changed files with 45 additions and 9 deletions

View File

@@ -155,9 +155,24 @@ impl super::View for WidgetGallery {
});
ui.end_row();
ui.label("Custom widget");
ui.label("Custom widget:");
super::toggle_switch::demo(ui, boolean);
ui.end_row();
ui.label("Plot:");
let n = 512;
let curve = egui::plot::Curve::from_values_iter((0..=n).map(|i| {
use std::f64::consts::TAU;
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
egui::plot::Value::new(x, x.sin())
}));
ui.add(
egui::plot::Plot::default()
.curve(curve)
.height(32.0)
.data_aspect(1.0),
);
ui.end_row();
});
ui.separator();