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

Small plot-relates fixes (#526)

* plot: take any id source as argument instead of ToString

* plot: allow user to set stroke on HLine/VLine

* Update changelog
This commit is contained in:
Emil Ernerfeldt
2021-06-28 10:51:06 +02:00
committed by GitHub
parent 3a14f5e8e2
commit cba840ec49
5 changed files with 55 additions and 12 deletions

View File

@@ -121,7 +121,7 @@ impl Widget for &mut LineDemo {
ui.ctx().request_repaint();
self.time += ui.input().unstable_dt.at_most(1.0 / 30.0) as f64;
};
let mut plot = Plot::new("Lines Demo")
let mut plot = Plot::new("lines_demo")
.line(self.circle())
.line(self.sin())
.line(self.thingy())
@@ -201,7 +201,7 @@ impl Widget for &mut MarkerDemo {
}
});
let mut markers_plot = Plot::new("Markers Demo")
let mut markers_plot = Plot::new("markers_demo")
.data_aspect(1.0)
.legend(Legend::default());
for marker in self.markers() {
@@ -266,7 +266,7 @@ impl Widget for &mut LegendDemo {
ui.end_row();
});
let legend_plot = Plot::new("Legend Demo")
let legend_plot = Plot::new("legend_demo")
.line(LegendDemo::line_with_slope(0.5).name("lines"))
.line(LegendDemo::line_with_slope(1.0).name("lines"))
.line(LegendDemo::line_with_slope(2.0).name("lines"))
@@ -325,7 +325,7 @@ impl Widget for &mut ItemsDemo {
],
);
let plot = Plot::new("Items Demo")
let plot = Plot::new("items_demo")
.hline(HLine::new(9.0).name("Lines horizontal"))
.hline(HLine::new(-9.0).name("Lines horizontal"))
.vline(VLine::new(9.0).name("Lines vertical"))

View File

@@ -219,7 +219,7 @@ fn example_plot() -> egui::plot::Plot {
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
Value::new(x, x.sin())
})));
Plot::new("Example Plot")
Plot::new("example_plot")
.line(line)
.height(32.0)
.data_aspect(1.0)