fixup and remove egui legend

This commit is contained in:
Simon Gardling 2022-05-17 01:15:44 -04:00
parent 8cca3b03dc
commit 40424719cb
3 changed files with 1 additions and 17 deletions

View File

@ -7,7 +7,6 @@
- Prevent user from making too many function entries
- Display function errors as tooltips or a warning box (not preventing the display of the graph)
- Clone functions
- Better integration with egui's legend
2. Smart display of graph
- Display of intersections between functions
3. Allow constants in min/max integral input (like pi or euler's number)

View File

@ -378,10 +378,6 @@ impl FunctionEntry {
.collect();
debug_assert_eq!(data.len(), settings.plot_width + 1);
self.derivative_data = data;
unsafe {
assume(!self.derivative_data.is_empty());
}
}
if self.nth_derviative && self.nth_derivative_data.is_none() {
@ -390,10 +386,6 @@ impl FunctionEntry {
.collect();
debug_assert_eq!(data.len(), settings.plot_width + 1);
self.nth_derivative_data = Some(data);
unsafe {
assume(self.nth_derivative_data.is_some());
}
}
}
@ -407,9 +399,6 @@ impl FunctionEntry {
);
self.integral_data =
Some((data.iter().map(|(x, y)| Bar::new(*x, *y)).collect(), area));
unsafe {
assume(self.integral_data.is_some());
}
}
} else {
self.invalidate_integral();

View File

@ -566,17 +566,13 @@ impl App for MathApp {
let available_width: usize = (ui.available_width() as usize) + 1; // Used in later logic
let width_changed = available_width != self.settings.plot_width;
if width_changed {
self.settings.plot_width = available_width;
}
self.settings.plot_width = available_width;
// Create and setup plot
Plot::new("plot")
.set_margin_fraction(Vec2::ZERO)
.data_aspect(1.0)
.include_y(0)
.legend(egui::plot::Legend::default())
.show(ui, |plot_ui| {
let bounds = plot_ui.plot_bounds();
let min_x: f64 = bounds.min()[0];