This commit is contained in:
Simon Gardling
2022-03-09 21:15:12 -05:00
parent 99592915e1
commit 232f470ce1
3 changed files with 42 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ pub struct FunctionOutput {
pub(crate) integral: Option<(Vec<Bar>, f64)>,
pub(crate) derivative: Option<Vec<Value>>,
pub(crate) extrema: Option<Vec<Value>>,
pub(crate) roots: Option<Vec<Value>>,
}
impl FunctionOutput {
@@ -23,6 +24,7 @@ impl FunctionOutput {
integral: None,
derivative: None,
extrema: None,
roots: None,
}
}
@@ -31,6 +33,7 @@ impl FunctionOutput {
self.integral = None;
self.derivative = None;
self.extrema = None;
self.roots = None;
}
pub fn invalidate_back(&mut self) { self.back = None; }
@@ -68,6 +71,15 @@ impl FunctionOutput {
);
}
if let Some(roots_data) = self.roots.clone() {
plot_ui.points(
Points::new(Values::from_values(roots_data))
.color(Color32::LIGHT_BLUE)
.name("Root")
.radius(5.0),
);
}
if let Some(integral_data) = self.integral.clone() {
plot_ui.bar_chart(
BarChart::new(integral_data.0)