pub struct Grid { /* private fields */ }Expand description
Axis-aligned grid lines across a plot, at the given x and y positions.
Implementations§
Source§impl Grid
impl Grid
pub fn new() -> Self
Sourcepub fn x(self, x: impl IntoIterator<Item = impl Into<Pixels>>) -> Self
pub fn x(self, x: impl IntoIterator<Item = impl Into<Pixels>>) -> Self
Set the positions of the vertical lines, from the left of the plot.
Sourcepub fn y(self, y: impl IntoIterator<Item = impl Into<Pixels>>) -> Self
pub fn y(self, y: impl IntoIterator<Item = impl Into<Pixels>>) -> Self
Set the positions of the horizontal lines, from the top of the plot.
Sourcepub fn stroke(self, stroke: impl Into<Background>) -> Self
pub fn stroke(self, stroke: impl Into<Background>) -> Self
Set the stroke of the grid lines.
Sourcepub fn dash_array(self, dash_array: &[Pixels]) -> Self
pub fn dash_array(self, dash_array: &[Pixels]) -> Self
Set the dash array of the grid lines.
Sourcepub fn paint(&self, bounds: &Bounds<Pixels>, window: &mut Window)
pub fn paint(&self, bounds: &Bounds<Pixels>, window: &mut Window)
Paint the Grid.
Grid lines are axis-aligned, so each one (or each dash of one) is a 1px quad rather than a stroked path: a chart repaints its grid on every frame while it scrolls, and tessellating each line — measuring and sampling it first when dashed — was the largest cost of painting a chart card.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl UnwindSafe for Grid
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().