mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Drag and zoom support for plots (#317)
* drag and zoom support for plots * update doctest * use impl ToString * revert back to Into<String> until #302 is solved * Apply suggestions from code review Co-authored-by: ilya sheprut <optitel223@gmail.com> * use persistence feature for PlotMemory * rename shift -> translate * remove automatic bounds * removed unused methods * Into<String> -> ToString * Apply suggestions from code review Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com> * avoid potential invalid bounds bug * use new is_valid method * improve auto bounds behavior as suggested * use NOTHING to initialize min_auto_bounds Co-authored-by: ilya sheprut <optitel223@gmail.com> Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
cb14e8571f
commit
012542d066
@@ -139,7 +139,7 @@ impl super::View for PlotDemo {
|
||||
self.time += ui.input().unstable_dt.at_most(1.0 / 30.0) as f64;
|
||||
};
|
||||
|
||||
let mut plot = Plot::default()
|
||||
let mut plot = Plot::new("Demo Plot")
|
||||
.curve(self.circle())
|
||||
.curve(self.sin())
|
||||
.curve(self.thingy())
|
||||
|
||||
@@ -227,7 +227,7 @@ fn example_plot() -> egui::plot::Plot {
|
||||
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
|
||||
egui::plot::Value::new(x, x.sin())
|
||||
}));
|
||||
egui::plot::Plot::default()
|
||||
egui::plot::Plot::new("Example Plot")
|
||||
.curve(curve)
|
||||
.height(32.0)
|
||||
.data_aspect(1.0)
|
||||
|
||||
Reference in New Issue
Block a user