pub struct PlotUi { /* private fields */ }
Expand description
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 example of how to use it.
Implementations
sourceimpl PlotUi
impl PlotUi
pub fn ctx(&self) -> &Context
sourcepub fn plot_bounds(&self) -> PlotBounds
pub fn plot_bounds(&self) -> PlotBounds
The plot bounds as they were in the last frame. If called on the first frame and the bounds were not further specified in the plot builder, this will return bounds centered on the origin. The bounds do not change until the plot is drawn.
sourcepub fn plot_hovered(&self) -> bool
pub fn plot_hovered(&self) -> bool
Returns true
if the plot area is currently hovered.
sourcepub fn plot_clicked(&self) -> bool
pub fn plot_clicked(&self) -> bool
Returns true
if the plot was clicked by the primary button.
sourcepub fn pointer_coordinate(&self) -> Option<PlotPoint>
pub fn pointer_coordinate(&self) -> Option<PlotPoint>
The pointer position in plot coordinates. Independent of whether the pointer is in the plot area.
sourcepub fn pointer_coordinate_drag_delta(&self) -> Vec2
pub fn pointer_coordinate_drag_delta(&self) -> Vec2
The pointer drag delta in plot coordinates.
sourcepub fn screen_from_plot(&self, position: PlotPoint) -> Pos2
pub fn screen_from_plot(&self, position: PlotPoint) -> Pos2
Transform the plot coordinates to screen coordinates.
sourcepub fn plot_from_screen(&self, position: Pos2) -> PlotPoint
pub fn plot_from_screen(&self, position: Pos2) -> PlotPoint
Transform the screen coordinates to plot coordinates.
sourcepub fn hline(&mut self, hline: HLine)
pub fn hline(&mut self, hline: HLine)
Add a horizontal line. Can be useful e.g. to show min/max bounds or similar. Always fills the full width of the plot.