diff --git a/Makefile b/Makefile index 07235765..57385c1b 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ build_wasm: cargo build -p egui_plot -p demo --all-features --lib --tests --bins --examples --target $(TARGET_WASM) $(CARGO_OPTS) $(BUILD_PROFILE) trunk: - trunk build $(TRUNK_OPTS) + cd demo && trunk build $(TRUNK_OPTS) # -------------------------------- test ---------------------------------------- diff --git a/egui_plot/src/aesthetics.rs b/egui_plot/src/aesthetics.rs new file mode 100644 index 00000000..31cb647f --- /dev/null +++ b/egui_plot/src/aesthetics.rs @@ -0,0 +1,140 @@ +use egui::Shape; +use egui::Stroke; +use egui::epaint::ColorMode; +use egui::epaint::PathStroke; +use emath::Pos2; +use emath::Rect; +use emath::pos2; + +/// Solid, dotted, dashed, etc. +#[derive(Debug, PartialEq, Clone, Copy)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +pub enum LineStyle { + Solid, + Dotted { spacing: f32 }, + Dashed { length: f32 }, +} + +impl LineStyle { + pub fn dashed_loose() -> Self { + Self::Dashed { length: 10.0 } + } + + pub fn dashed_dense() -> Self { + Self::Dashed { length: 5.0 } + } + + pub fn dotted_loose() -> Self { + Self::Dotted { spacing: 10.0 } + } + + pub fn dotted_dense() -> Self { + Self::Dotted { spacing: 5.0 } + } + + pub(crate) fn style_line(&self, line: Vec, mut stroke: PathStroke, highlight: bool, shapes: &mut Vec) { + let path_stroke_color = match &stroke.color { + ColorMode::Solid(c) => *c, + ColorMode::UV(callback) => callback(Rect::from_min_max(pos2(0., 0.), pos2(0., 0.)), pos2(0., 0.)), + }; + match line.len() { + 0 => {} + 1 => { + let mut radius = stroke.width / 2.0; + if highlight { + radius *= 2f32.sqrt(); + } + shapes.push(Shape::circle_filled(line[0], radius, path_stroke_color)); + } + _ => { + match self { + Self::Solid => { + if highlight { + stroke.width *= 2.0; + } + shapes.push(Shape::line(line, stroke)); + } + Self::Dotted { spacing } => { + // Take the stroke width for the radius even though it's not "correct", + // otherwise the dots would become too small. + let mut radius = stroke.width; + if highlight { + radius *= 2f32.sqrt(); + } + shapes.extend(Shape::dotted_line(&line, path_stroke_color, *spacing, radius)); + } + Self::Dashed { length } => { + if highlight { + stroke.width *= 2.0; + } + let golden_ratio = (5.0_f32.sqrt() - 1.0) / 2.0; // 0.61803398875 + shapes.extend(Shape::dashed_line( + &line, + Stroke::new(stroke.width, path_stroke_color), + *length, + length * golden_ratio, + )); + } + } + } + } + } +} + +impl std::fmt::Display for LineStyle { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Solid => write!(f, "Solid"), + Self::Dotted { spacing } => write!(f, "Dotted({spacing} px)"), + Self::Dashed { length } => write!(f, "Dashed({length} px)"), + } + } +} + +/// Determines whether a plot element is vertically or horizontally oriented. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum Orientation { + Horizontal, + Vertical, +} + +impl Default for Orientation { + fn default() -> Self { + Self::Vertical + } +} + +/// Circle, Diamond, Square, Cross, … +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum MarkerShape { + Circle, + Diamond, + Square, + Cross, + Plus, + Up, + Down, + Left, + Right, + Asterisk, +} + +impl MarkerShape { + /// Get a vector containing all marker shapes. + pub fn all() -> impl ExactSizeIterator { + [ + Self::Circle, + Self::Diamond, + Self::Square, + Self::Cross, + Self::Plus, + Self::Up, + Self::Down, + Self::Left, + Self::Right, + Self::Asterisk, + ] + .iter() + .copied() + } +} diff --git a/egui_plot/src/values.rs b/egui_plot/src/data.rs similarity index 58% rename from egui_plot/src/values.rs rename to egui_plot/src/data.rs index c08823b7..4aed1f75 100644 --- a/egui_plot/src/values.rs +++ b/egui_plot/src/data.rs @@ -1,16 +1,11 @@ -use std::ops::Bound; +use std::collections::Bound; +use std::iter::FromIterator; use std::ops::RangeBounds; use std::ops::RangeInclusive; -use egui::Pos2; -use egui::Rect; -use egui::Shape; -use egui::Stroke; -use egui::Vec2; -use egui::epaint::ColorMode; -use egui::epaint::PathStroke; -use egui::lerp; -use egui::pos2; +use emath::Pos2; +use emath::Vec2; +use emath::lerp; use crate::bounds::PlotBounds; @@ -55,110 +50,6 @@ impl PlotPoint { } } -// ---------------------------------------------------------------------------- - -/// Solid, dotted, dashed, etc. -#[derive(Debug, PartialEq, Clone, Copy)] -#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] -pub enum LineStyle { - Solid, - Dotted { spacing: f32 }, - Dashed { length: f32 }, -} - -impl LineStyle { - pub fn dashed_loose() -> Self { - Self::Dashed { length: 10.0 } - } - - pub fn dashed_dense() -> Self { - Self::Dashed { length: 5.0 } - } - - pub fn dotted_loose() -> Self { - Self::Dotted { spacing: 10.0 } - } - - pub fn dotted_dense() -> Self { - Self::Dotted { spacing: 5.0 } - } - - pub(super) fn style_line(&self, line: Vec, mut stroke: PathStroke, highlight: bool, shapes: &mut Vec) { - let path_stroke_color = match &stroke.color { - ColorMode::Solid(c) => *c, - ColorMode::UV(callback) => callback(Rect::from_min_max(pos2(0., 0.), pos2(0., 0.)), pos2(0., 0.)), - }; - match line.len() { - 0 => {} - 1 => { - let mut radius = stroke.width / 2.0; - if highlight { - radius *= 2f32.sqrt(); - } - shapes.push(Shape::circle_filled(line[0], radius, path_stroke_color)); - } - _ => { - match self { - Self::Solid => { - if highlight { - stroke.width *= 2.0; - } - shapes.push(Shape::line(line, stroke)); - } - Self::Dotted { spacing } => { - // Take the stroke width for the radius even though it's not "correct", - // otherwise the dots would become too small. - let mut radius = stroke.width; - if highlight { - radius *= 2f32.sqrt(); - } - shapes.extend(Shape::dotted_line(&line, path_stroke_color, *spacing, radius)); - } - Self::Dashed { length } => { - if highlight { - stroke.width *= 2.0; - } - let golden_ratio = (5.0_f32.sqrt() - 1.0) / 2.0; // 0.61803398875 - shapes.extend(Shape::dashed_line( - &line, - Stroke::new(stroke.width, path_stroke_color), - *length, - length * golden_ratio, - )); - } - } - } - } - } -} - -impl std::fmt::Display for LineStyle { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Solid => write!(f, "Solid"), - Self::Dotted { spacing } => write!(f, "Dotted({spacing} px)"), - Self::Dashed { length } => write!(f, "Dashed({length} px)"), - } - } -} - -// ---------------------------------------------------------------------------- - -/// Determines whether a plot element is vertically or horizontally oriented. -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum Orientation { - Horizontal, - Vertical, -} - -impl Default for Orientation { - fn default() -> Self { - Self::Vertical - } -} - -// ---------------------------------------------------------------------------- - /// Represents many [`PlotPoint`]s. /// /// These can be an owned `Vec` @@ -286,7 +177,7 @@ impl<'a> PlotPoints<'a> { /// Returns true if there are no data points available and there is no /// function to generate any. - pub(crate) fn is_empty(&self) -> bool { + pub fn is_empty(&self) -> bool { match self { Self::Owned(points) => points.is_empty(), Self::Generator(_) => false, @@ -296,7 +187,7 @@ impl<'a> PlotPoints<'a> { /// If initialized with a generator function, this will generate `n` evenly /// spaced points in the given range. - pub(super) fn generate_points(&mut self, x_range: RangeInclusive) { + pub fn generate_points(&mut self, x_range: RangeInclusive) { if let Self::Generator(generator) = self { *self = Self::range_intersection(&x_range, &generator.x_range) .map(|intersection| { @@ -320,7 +211,7 @@ impl<'a> PlotPoints<'a> { (start < end).then_some(start..=end) } - pub(super) fn bounds(&self) -> PlotBounds { + pub fn bounds(&self) -> PlotBounds { match self { Self::Owned(points) => { let mut bounds = PlotBounds::NOTHING; @@ -341,62 +232,6 @@ impl<'a> PlotPoints<'a> { } } -// ---------------------------------------------------------------------------- - -/// Circle, Diamond, Square, Cross, … -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum MarkerShape { - Circle, - Diamond, - Square, - Cross, - Plus, - Up, - Down, - Left, - Right, - Asterisk, -} - -impl MarkerShape { - /// Get a vector containing all marker shapes. - pub fn all() -> impl ExactSizeIterator { - [ - Self::Circle, - Self::Diamond, - Self::Square, - Self::Cross, - Self::Plus, - Self::Up, - Self::Down, - Self::Left, - Self::Right, - Self::Asterisk, - ] - .iter() - .copied() - } -} - -// ---------------------------------------------------------------------------- - -/// Query the points of the plot, for geometric relations like closest checks -pub enum PlotGeometry<'a> { - /// No geometry based on single elements (examples: text, image, - /// horizontal/vertical line) - None, - - /// Point values (X-Y graphs) - Points(&'a [PlotPoint]), - - /// Rectangles (examples: boxes or bars) - // Has currently no data, as it would require copying rects or iterating a list of pointers. - // Instead, geometry-based functions are directly implemented in the respective PlotItem impl. - Rects, -} - -// ---------------------------------------------------------------------------- - /// Describes a function y = f(x) with an optional range for x and a number of /// points. pub struct ExplicitGenerator<'a> { @@ -447,16 +282,3 @@ impl ExplicitGenerator<'_> { bounds } } - -// ---------------------------------------------------------------------------- - -/// Result of [`super::PlotItem::find_closest()`] search, identifies an element -/// inside the item for immediate use -pub struct ClosestElem { - /// Position of hovered-over value (or bar/box-plot/…) in `PlotItem` - pub index: usize, - - /// Squared distance from the mouse cursor (needed to compare against other - /// `PlotItems`, which might be nearer) - pub dist_sq: f32, -} diff --git a/egui_plot/src/items/arrows.rs b/egui_plot/src/items/arrows.rs index eaa97049..ee2315fc 100644 --- a/egui_plot/src/items/arrows.rs +++ b/egui_plot/src/items/arrows.rs @@ -6,13 +6,13 @@ use egui::Stroke; use egui::Ui; use emath::Rot2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; use crate::bounds::PlotBounds; -use crate::values::PlotGeometry; -use crate::values::PlotPoints; +use crate::data::PlotPoints; impl<'a> Arrows<'a> { pub fn new(name: impl Into, origins: impl Into>, tips: impl Into>) -> Self { diff --git a/egui_plot/src/items/bar_chart.rs b/egui_plot/src/items/bar_chart.rs index e7bf7351..dbdf8363 100644 --- a/egui_plot/src/items/bar_chart.rs +++ b/egui_plot/src/items/bar_chart.rs @@ -10,6 +10,8 @@ use emath::Float as _; use emath::NumExt as _; use emath::Pos2; +use super::ClosestElem; +use super::PlotGeometry; use super::add_rulers_and_text; use crate::Cursor; use crate::Id; @@ -17,15 +19,13 @@ use crate::PlotConfig; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::Orientation; use crate::bounds::PlotBounds; use crate::colors::highlighted_color; +use crate::data::PlotPoint; use crate::label::LabelFormatter; use crate::math::find_closest_rect; use crate::rect_elem::RectElement; -use crate::values::ClosestElem; -use crate::values::Orientation; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; /// A bar chart. pub struct BarChart { diff --git a/egui_plot/src/items/box_plot.rs b/egui_plot/src/items/box_plot.rs index 08463a47..0d53137b 100644 --- a/egui_plot/src/items/box_plot.rs +++ b/egui_plot/src/items/box_plot.rs @@ -9,6 +9,8 @@ use egui::epaint::RectShape; use emath::NumExt as _; use emath::Pos2; +use super::ClosestElem; +use super::PlotGeometry; use super::add_rulers_and_text; use crate::Cursor; use crate::Id; @@ -16,15 +18,13 @@ use crate::PlotConfig; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::Orientation; use crate::bounds::PlotBounds; use crate::colors::highlighted_color; +use crate::data::PlotPoint; use crate::label::LabelFormatter; use crate::math::find_closest_rect; use crate::rect_elem::RectElement; -use crate::values::ClosestElem; -use crate::values::Orientation; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; /// A diagram containing a series of [`BoxElem`] elements. pub struct BoxPlot { diff --git a/egui_plot/src/items/heatmap.rs b/egui_plot/src/items/heatmap.rs index 4f34e721..b1c7aaf9 100644 --- a/egui_plot/src/items/heatmap.rs +++ b/egui_plot/src/items/heatmap.rs @@ -13,17 +13,17 @@ use egui::Vec2; use egui::WidgetText; use emath::Float as _; +use super::ClosestElem; use super::Cursor; +use super::PlotGeometry; use super::PlotTransform; use crate::PlotConfig; use crate::PlotItem; use crate::PlotItemBase; use crate::bounds::PlotBounds; use crate::colors::BASE_COLORS; +use crate::data::PlotPoint; use crate::label::LabelFormatter; -use crate::values::ClosestElem; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; /// Default resolution for heatmap color palette pub const DEFAULT_RESOLUTION: usize = 128; diff --git a/egui_plot/src/items/line.rs b/egui_plot/src/items/line.rs index 2bd67848..5eb3e4db 100644 --- a/egui_plot/src/items/line.rs +++ b/egui_plot/src/items/line.rs @@ -8,14 +8,14 @@ use egui::epaint::PathStroke; use emath::Pos2; use emath::pos2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::LineStyle; use crate::bounds::PlotBounds; -use crate::values::LineStyle; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; +use crate::data::PlotPoint; /// A horizontal line in a plot, filling the full width #[derive(Clone, Debug, PartialEq)] diff --git a/egui_plot/src/items/mod.rs b/egui_plot/src/items/mod.rs index 007a30e0..512dd9e5 100644 --- a/egui_plot/src/items/mod.rs +++ b/egui_plot/src/items/mod.rs @@ -34,14 +34,11 @@ pub use text::Text; use super::Cursor; use super::PlotTransform; +use crate::aesthetics::Orientation; use crate::bounds::PlotBounds; +use crate::data::PlotPoint; use crate::label::LabelFormatter; use crate::rect_elem::RectElement; -use crate::values::ClosestElem; -use crate::values::LineStyle; -use crate::values::Orientation; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; mod arrows; mod bar_chart; @@ -326,3 +323,29 @@ pub(super) fn rulers_and_tooltip_at_value( ui.label(text); }); } + +/// Query the points of the plot, for geometric relations like closest checks +pub enum PlotGeometry<'a> { + /// No geometry based on single elements (examples: text, image, + /// horizontal/vertical line) + None, + + /// Point values (X-Y graphs) + Points(&'a [PlotPoint]), + + /// Rectangles (examples: boxes or bars) + // Has currently no data, as it would require copying rects or iterating a list of pointers. + // Instead, geometry-based functions are directly implemented in the respective PlotItem impl. + Rects, +} + +/// Result of [`PlotItem::find_closest()`] search, identifies an element +/// inside the item for immediate use +pub struct ClosestElem { + /// Position of hovered-over value (or bar/box-plot/…) in `PlotItem` + pub index: usize, + + /// Squared distance from the mouse cursor (needed to compare against other + /// `PlotItems`, which might be nearer) + pub dist_sq: f32, +} diff --git a/egui_plot/src/items/plot_image.rs b/egui_plot/src/items/plot_image.rs index be0b41a4..46939e7e 100644 --- a/egui_plot/src/items/plot_image.rs +++ b/egui_plot/src/items/plot_image.rs @@ -12,13 +12,13 @@ use emath::Rot2; use emath::Vec2; use emath::pos2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; use crate::bounds::PlotBounds; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; +use crate::data::PlotPoint; /// An image in the plot. #[derive(Clone)] diff --git a/egui_plot/src/items/points.rs b/egui_plot/src/items/points.rs index 24a02b08..51417397 100644 --- a/egui_plot/src/items/points.rs +++ b/egui_plot/src/items/points.rs @@ -9,15 +9,15 @@ use emath::Pos2; use emath::pos2; use emath::vec2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::MarkerShape; use crate::bounds::PlotBounds; -use crate::values::MarkerShape; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; -use crate::values::PlotPoints; +use crate::data::PlotPoint; +use crate::data::PlotPoints; impl<'a> Points<'a> { pub fn new(name: impl Into, series: impl Into>) -> Self { diff --git a/egui_plot/src/items/polygon.rs b/egui_plot/src/items/polygon.rs index 9e431b48..0fd82aa0 100644 --- a/egui_plot/src/items/polygon.rs +++ b/egui_plot/src/items/polygon.rs @@ -7,14 +7,14 @@ use egui::Stroke; use egui::Ui; use egui::epaint::PathStroke; +use super::PlotGeometry; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::LineStyle; use crate::bounds::PlotBounds; use crate::colors::DEFAULT_FILL_ALPHA; -use crate::values::LineStyle; -use crate::values::PlotGeometry; -use crate::values::PlotPoints; +use crate::data::PlotPoints; /// A convex polygon. pub struct Polygon<'a> { diff --git a/egui_plot/src/items/series.rs b/egui_plot/src/items/series.rs index a3e88f48..b347f96d 100644 --- a/egui_plot/src/items/series.rs +++ b/egui_plot/src/items/series.rs @@ -13,17 +13,17 @@ use emath::Pos2; use emath::Rect; use emath::pos2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; +use crate::aesthetics::LineStyle; use crate::bounds::PlotBounds; use crate::colors::DEFAULT_FILL_ALPHA; +use crate::data::PlotPoint; +use crate::data::PlotPoints; use crate::math::y_intersection; -use crate::values::LineStyle; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; -use crate::values::PlotPoints; /// A series of values forming a path. pub struct Line<'a> { diff --git a/egui_plot/src/items/span.rs b/egui_plot/src/items/span.rs index c990d4d5..4fd25a2b 100644 --- a/egui_plot/src/items/span.rs +++ b/egui_plot/src/items/span.rs @@ -15,13 +15,13 @@ use egui::epaint::TextShape; use egui::pos2; use emath::TSTransform; -use super::LineStyle; use super::PlotGeometry; use super::PlotItem; use super::PlotItemBase; use super::PlotPoint; use super::PlotTransform; use crate::Axis; +use crate::aesthetics::LineStyle; use crate::bounds::PlotBounds; use crate::colors::highlighted_color; use crate::utils::find_name_candidate; diff --git a/egui_plot/src/items/text.rs b/egui_plot/src/items/text.rs index b0632f20..0ccaf461 100644 --- a/egui_plot/src/items/text.rs +++ b/egui_plot/src/items/text.rs @@ -9,13 +9,13 @@ use egui::WidgetText; use egui::epaint::TextShape; use emath::Align2; +use super::PlotGeometry; use crate::Id; use crate::PlotItem; use crate::PlotItemBase; use crate::PlotTransform; use crate::bounds::PlotBounds; -use crate::values::PlotGeometry; -use crate::values::PlotPoint; +use crate::data::PlotPoint; impl Text { pub fn new(name: impl Into, position: PlotPoint, text: impl Into) -> Self { diff --git a/egui_plot/src/lib.rs b/egui_plot/src/lib.rs index 9b728806..71ad004d 100644 --- a/egui_plot/src/lib.rs +++ b/egui_plot/src/lib.rs @@ -8,10 +8,12 @@ #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] //! +mod aesthetics; mod axis; mod bounds; mod colors; mod cursor; +mod data; mod grid; mod items; mod label; @@ -24,7 +26,6 @@ mod plot_ui; mod rect_elem; mod transform; mod utils; -mod values; pub use bounds::PlotBounds; use egui::Id; @@ -34,12 +35,17 @@ pub use placement::HPlacement; pub use placement::Placement; pub use placement::VPlacement; +pub use crate::aesthetics::LineStyle; +pub use crate::aesthetics::MarkerShape; +pub use crate::aesthetics::Orientation; pub use crate::axis::Axis; pub use crate::axis::AxisHints; pub use crate::colors::color_from_strength; pub use crate::cursor::Cursor; pub(crate) use crate::cursor::CursorLinkGroups; pub(crate) use crate::cursor::PlotFrameCursors; +pub use crate::data::PlotPoint; +pub use crate::data::PlotPoints; pub use crate::grid::GridInput; pub use crate::grid::GridMark; pub use crate::grid::log_grid_spacer; @@ -50,10 +56,12 @@ pub use crate::items::BarChart; pub use crate::items::BoxElem; pub use crate::items::BoxPlot; pub use crate::items::BoxSpread; +pub use crate::items::ClosestElem; pub use crate::items::HLine; pub use crate::items::Heatmap; pub use crate::items::Line; pub use crate::items::PlotConfig; +pub use crate::items::PlotGeometry; pub use crate::items::PlotImage; pub use crate::items::PlotItem; pub use crate::items::PlotItemBase; @@ -71,10 +79,3 @@ pub use crate::plot::Plot; pub use crate::plot::PlotResponse; pub use crate::plot_ui::PlotUi; pub use crate::transform::PlotTransform; -pub use crate::values::ClosestElem; -pub use crate::values::LineStyle; -pub use crate::values::MarkerShape; -pub use crate::values::Orientation; -pub use crate::values::PlotGeometry; -pub use crate::values::PlotPoint; -pub use crate::values::PlotPoints; diff --git a/egui_plot/src/math.rs b/egui_plot/src/math.rs index cdfdd9ef..402e7706 100644 --- a/egui_plot/src/math.rs +++ b/egui_plot/src/math.rs @@ -1,8 +1,8 @@ use emath::Float as _; use emath::Pos2; -use crate::ClosestElem; use crate::PlotTransform; +use crate::items::ClosestElem; use crate::rect_elem::RectElement; /// Returns the x-coordinate of a possible intersection between a line segment diff --git a/egui_plot/src/overlays/coordinates.rs b/egui_plot/src/overlays/coordinates.rs index 4b687a38..e60c44ed 100644 --- a/egui_plot/src/overlays/coordinates.rs +++ b/egui_plot/src/overlays/coordinates.rs @@ -1,5 +1,5 @@ use crate::bounds::PlotBounds; -use crate::values::PlotPoint; +use crate::data::PlotPoint; type CoordinatesFormatterFn<'a> = dyn Fn(&PlotPoint, &PlotBounds) -> String + 'a; diff --git a/egui_plot/src/plot.rs b/egui_plot/src/plot.rs index 7a88ea00..53101600 100644 --- a/egui_plot/src/plot.rs +++ b/egui_plot/src/plot.rs @@ -41,6 +41,7 @@ use crate::bounds::BoundsModification; use crate::bounds::LinkedBounds; use crate::bounds::PlotBounds; use crate::colors::rulers_color; +use crate::data::PlotPoint; use crate::grid::GridInput; use crate::grid::GridMark; use crate::grid::GridSpacer; @@ -53,7 +54,6 @@ use crate::overlays::legend::LegendWidget; use crate::placement::Corner; use crate::placement::HPlacement; use crate::placement::VPlacement; -use crate::values::PlotPoint; /// Combined axis widgets: `[x_axis_widgets, y_axis_widgets]` type AxisWidgets<'a> = [Vec>; 2]; diff --git a/egui_plot/src/plot_ui.rs b/egui_plot/src/plot_ui.rs index 6dcf2dd6..d1f316fa 100644 --- a/egui_plot/src/plot_ui.rs +++ b/egui_plot/src/plot_ui.rs @@ -14,7 +14,7 @@ use crate::PlotTransform; use crate::Span; use crate::bounds::BoundsModification; use crate::bounds::PlotBounds; -use crate::values::PlotPoint; +use crate::data::PlotPoint; /// Provides methods to interact with a plot while building it. It is the single /// argument of the closure provided to [`Plot::show`]. See [`Plot`] for an diff --git a/egui_plot/src/rect_elem.rs b/egui_plot/src/rect_elem.rs index 61d18ce5..f3c059fa 100644 --- a/egui_plot/src/rect_elem.rs +++ b/egui_plot/src/rect_elem.rs @@ -1,5 +1,5 @@ -use super::Orientation; use super::PlotPoint; +use crate::aesthetics::Orientation; use crate::bounds::PlotBounds; use crate::transform::PlotTransform;