pub struct Span { /* private fields */ }Expand description
A span covering a range on either axis.
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(
name: impl Into<String>,
range: impl Into<RangeInclusive<f64>>,
) -> Self
pub fn new( name: impl Into<String>, range: impl Into<RangeInclusive<f64>>, ) -> Self
Create a new span covering the provided range on the X axis by default.
Sourcepub fn axis(self, axis: Axis) -> Self
pub fn axis(self, axis: Axis) -> Self
Select which axis the span applies to. This also sets the label
alignment. If you want a different label alignment, you need to set
it by calling label_align after this call.
Sourcepub fn range(self, range: impl Into<RangeInclusive<f64>>) -> Self
pub fn range(self, range: impl Into<RangeInclusive<f64>>) -> Self
Set the range.
Sourcepub fn fill(self, color: impl Into<Color32>) -> Self
pub fn fill(self, color: impl Into<Color32>) -> Self
Set the background fill color for the span.
Sourcepub fn border(self, stroke: impl Into<Stroke>) -> Self
pub fn border(self, stroke: impl Into<Stroke>) -> Self
Set the stroke used for both span borders.
Sourcepub fn border_width(self, width: impl Into<f32>) -> Self
pub fn border_width(self, width: impl Into<f32>) -> Self
Convenience for updating the span border width.
Sourcepub fn border_color(self, color: impl Into<Color32>) -> Self
pub fn border_color(self, color: impl Into<Color32>) -> Self
Convenience for updating the span border color.
Sourcepub fn border_style(self, style: LineStyle) -> Self
pub fn border_style(self, style: LineStyle) -> Self
Set the style for the span borders. Defaults to LineStyle::Solid.
Sourcepub fn label_align(self, align: Align2) -> Self
pub fn label_align(self, align: Align2) -> Self
Set the label alignment within the span.
This should be called after any calls to axis as that would overwrite
the label alignment
Trait Implementations§
Source§impl PlotItem for Span
impl PlotItem for Span
Source§fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
Generate shapes to be drawn in the plot.
Source§fn initialize(&mut self, _x_range: RangeInclusive<f64>)
fn initialize(&mut self, _x_range: RangeInclusive<f64>)
For plot-items which are generated based on x values (plotting
functions).
Source§fn geometry(&self) -> PlotGeometry<'_>
fn geometry(&self) -> PlotGeometry<'_>
Returns the geometry of the plot item.
Source§fn bounds(&self) -> PlotBounds
fn bounds(&self) -> PlotBounds
Returns the bounds of the plot item.
Source§fn base(&self) -> &PlotItemBase
fn base(&self) -> &PlotItemBase
Returns a reference to the base data of the plot item.
Source§fn base_mut(&mut self) -> &mut PlotItemBase
fn base_mut(&mut self) -> &mut PlotItemBase
Returns a mutable reference to the base data of the plot item.
Source§fn highlighted(&self) -> bool
fn highlighted(&self) -> bool
Returns whether the plot item is highlighted.
Source§fn allow_hover(&self) -> bool
fn allow_hover(&self) -> bool
Can the user hover this item?
Source§fn find_closest(
&self,
point: Pos2,
transform: &PlotTransform,
) -> Option<ClosestElem>
fn find_closest( &self, point: Pos2, transform: &PlotTransform, ) -> Option<ClosestElem>
Find the closest element in the plot item to the given point.
Source§fn on_hover(
&self,
plot_area_response: &Response,
elem: ClosestElem,
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
label_formatter: &Option<LabelFormatter<'_>>,
)
fn on_hover( &self, plot_area_response: &Response, elem: ClosestElem, shapes: &mut Vec<Shape>, cursors: &mut Vec<Cursor>, plot: &PlotConfig<'_>, label_formatter: &Option<LabelFormatter<'_>>, )
Handle hover events for the plot item.
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more