simplify some code

This commit is contained in:
Simon Gardling 2022-03-01 22:00:31 -05:00
parent 9e01b1862c
commit e4b3d9c4a4

View File

@ -375,13 +375,16 @@ impl epi::App for MathApp {
let (back_values, bars) = function.run(); let (back_values, bars) = function.run();
plot_ui.line(back_values.color(Color32::RED)); plot_ui.line(back_values.color(Color32::RED));
if let Some(bars_data) = bars { area_list.push({
let (bar_chart, area) = bars_data; if let Some(bars_data) = bars {
plot_ui.bar_chart(bar_chart.color(Color32::BLUE).width(step)); let (bar_chart, area) = bars_data;
area_list.push(digits_precision(area, 8)) plot_ui
} else { .bar_chart(bar_chart.color(Color32::BLUE).width(step));
area_list.push(f64::NAN); digits_precision(area, 8)
} } else {
f64::NAN
}
});
} }
}); });
}); });