Spelling fix (#3133)

This commit is contained in:
Forest Anderson 2023-07-26 13:00:51 -04:00 committed by GitHub
parent 67d5bd4392
commit 936c9583b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 21 deletions

View File

@ -39,8 +39,8 @@ pub struct PlotDemo {
charts_demo: ChartsDemo, charts_demo: ChartsDemo,
items_demo: ItemsDemo, items_demo: ItemsDemo,
interaction_demo: InteractionDemo, interaction_demo: InteractionDemo,
custom_axes_demo: CustomAxisDemo, custom_axes_demo: CustomAxesDemo,
linked_axes_demo: LinkedAxisDemo, linked_axes_demo: LinkedAxesDemo,
open_panel: Panel, open_panel: Panel,
} }
@ -448,19 +448,19 @@ impl LegendDemo {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#[derive(PartialEq, Default)] #[derive(PartialEq, Default)]
struct CustomAxisDemo {} struct CustomAxesDemo {}
impl CustomAxisDemo { impl CustomAxesDemo {
const MINS_PER_DAY: f64 = 24.0 * 60.0; const MINS_PER_DAY: f64 = 24.0 * 60.0;
const MINS_PER_H: f64 = 60.0; const MINS_PER_H: f64 = 60.0;
fn logistic_fn() -> Line { fn logistic_fn() -> Line {
fn days(min: f64) -> f64 { fn days(min: f64) -> f64 {
CustomAxisDemo::MINS_PER_DAY * min CustomAxesDemo::MINS_PER_DAY * min
} }
let values = PlotPoints::from_explicit_callback( let values = PlotPoints::from_explicit_callback(
move |x| 1.0 / (1.0 + (-2.5 * (x / CustomAxisDemo::MINS_PER_DAY - 2.0)).exp()), move |x| 1.0 / (1.0 + (-2.5 * (x / CustomAxesDemo::MINS_PER_DAY - 2.0)).exp()),
days(0.0)..days(5.0), days(0.0)..days(5.0),
100, 100,
); );
@ -504,8 +504,8 @@ impl CustomAxisDemo {
#[allow(clippy::unused_self)] #[allow(clippy::unused_self)]
fn ui(&mut self, ui: &mut Ui) -> Response { fn ui(&mut self, ui: &mut Ui) -> Response {
const MINS_PER_DAY: f64 = CustomAxisDemo::MINS_PER_DAY; const MINS_PER_DAY: f64 = CustomAxesDemo::MINS_PER_DAY;
const MINS_PER_H: f64 = CustomAxisDemo::MINS_PER_H; const MINS_PER_H: f64 = CustomAxesDemo::MINS_PER_H;
fn day(x: f64) -> f64 { fn day(x: f64) -> f64 {
(x / MINS_PER_DAY).floor() (x / MINS_PER_DAY).floor()
@ -561,10 +561,10 @@ impl CustomAxisDemo {
.data_aspect(2.0 * MINS_PER_DAY as f32) .data_aspect(2.0 * MINS_PER_DAY as f32)
.x_axis_formatter(x_fmt) .x_axis_formatter(x_fmt)
.y_axis_formatter(y_fmt) .y_axis_formatter(y_fmt)
.x_grid_spacer(CustomAxisDemo::x_grid) .x_grid_spacer(CustomAxesDemo::x_grid)
.label_formatter(label_fmt) .label_formatter(label_fmt)
.show(ui, |plot_ui| { .show(ui, |plot_ui| {
plot_ui.line(CustomAxisDemo::logistic_fn()); plot_ui.line(CustomAxesDemo::logistic_fn());
}) })
.response .response
} }
@ -573,14 +573,14 @@ impl CustomAxisDemo {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#[derive(PartialEq)] #[derive(PartialEq)]
struct LinkedAxisDemo { struct LinkedAxesDemo {
link_x: bool, link_x: bool,
link_y: bool, link_y: bool,
link_cursor_x: bool, link_cursor_x: bool,
link_cursor_y: bool, link_cursor_y: bool,
} }
impl Default for LinkedAxisDemo { impl Default for LinkedAxesDemo {
fn default() -> Self { fn default() -> Self {
let link_x = true; let link_x = true;
let link_y = false; let link_y = false;
@ -595,7 +595,7 @@ impl Default for LinkedAxisDemo {
} }
} }
impl LinkedAxisDemo { impl LinkedAxesDemo {
fn line_with_slope(slope: f64) -> Line { fn line_with_slope(slope: f64) -> Line {
Line::new(PlotPoints::from_explicit_callback( Line::new(PlotPoints::from_explicit_callback(
move |x| slope * x, move |x| slope * x,
@ -621,11 +621,11 @@ impl LinkedAxisDemo {
} }
fn configure_plot(plot_ui: &mut plot::PlotUi) { fn configure_plot(plot_ui: &mut plot::PlotUi) {
plot_ui.line(LinkedAxisDemo::line_with_slope(0.5)); plot_ui.line(LinkedAxesDemo::line_with_slope(0.5));
plot_ui.line(LinkedAxisDemo::line_with_slope(1.0)); plot_ui.line(LinkedAxesDemo::line_with_slope(1.0));
plot_ui.line(LinkedAxisDemo::line_with_slope(2.0)); plot_ui.line(LinkedAxesDemo::line_with_slope(2.0));
plot_ui.line(LinkedAxisDemo::sin()); plot_ui.line(LinkedAxesDemo::sin());
plot_ui.line(LinkedAxisDemo::cos()); plot_ui.line(LinkedAxesDemo::cos());
} }
fn ui(&mut self, ui: &mut Ui) -> Response { fn ui(&mut self, ui: &mut Ui) -> Response {
@ -648,14 +648,14 @@ impl LinkedAxisDemo {
.height(250.0) .height(250.0)
.link_axis(link_group_id, self.link_x, self.link_y) .link_axis(link_group_id, self.link_x, self.link_y)
.link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y) .link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y)
.show(ui, LinkedAxisDemo::configure_plot); .show(ui, LinkedAxesDemo::configure_plot);
Plot::new("linked_axis_2") Plot::new("linked_axis_2")
.data_aspect(2.0) .data_aspect(2.0)
.width(150.0) .width(150.0)
.height(250.0) .height(250.0)
.link_axis(link_group_id, self.link_x, self.link_y) .link_axis(link_group_id, self.link_x, self.link_y)
.link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y) .link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y)
.show(ui, LinkedAxisDemo::configure_plot); .show(ui, LinkedAxesDemo::configure_plot);
}); });
Plot::new("linked_axis_3") Plot::new("linked_axis_3")
.data_aspect(0.5) .data_aspect(0.5)
@ -663,7 +663,7 @@ impl LinkedAxisDemo {
.height(150.0) .height(150.0)
.link_axis(link_group_id, self.link_x, self.link_y) .link_axis(link_group_id, self.link_x, self.link_y)
.link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y) .link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y)
.show(ui, LinkedAxisDemo::configure_plot) .show(ui, LinkedAxesDemo::configure_plot)
.response .response
} }
} }