pub struct CustomGrid<C: PixelColor> { /* private fields */ }Expand description
Custom grid with user-defined positions
Implementations§
Source§impl<C: PixelColor> CustomGrid<C>
impl<C: PixelColor> CustomGrid<C>
Sourcepub fn new(orientation: GridOrientation) -> Self
pub fn new(orientation: GridOrientation) -> Self
Create a new custom grid
Sourcepub fn horizontal() -> Self
pub fn horizontal() -> Self
Create a horizontal custom grid
Sourcepub fn add_line(&mut self, position: i32) -> Result<(), DataError>
pub fn add_line(&mut self, position: i32) -> Result<(), DataError>
Add a grid line at the specified position
Sourcepub fn clear_lines(&mut self)
pub fn clear_lines(&mut self)
Clear all grid lines
Sourcepub fn with_style(self, style: GridStyle<C>) -> Self
pub fn with_style(self, style: GridStyle<C>) -> Self
Set the grid style
Sourcepub fn with_lines(self, positions: &[i32]) -> Self
pub fn with_lines(self, positions: &[i32]) -> Self
Add lines with builder pattern
Trait Implementations§
Source§impl<C: Clone + PixelColor> Clone for CustomGrid<C>
impl<C: Clone + PixelColor> Clone for CustomGrid<C>
Source§fn clone(&self) -> CustomGrid<C>
fn clone(&self) -> CustomGrid<C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<C: Debug + PixelColor> Debug for CustomGrid<C>
impl<C: Debug + PixelColor> Debug for CustomGrid<C>
Source§impl<C: PixelColor + 'static> Grid<C> for CustomGrid<C>
impl<C: PixelColor + 'static> Grid<C> for CustomGrid<C>
Source§fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>where
D: DrawTarget<Color = C>,
fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>where
D: DrawTarget<Color = C>,
Draw the grid lines to the target Read more
Source§fn orientation(&self) -> GridOrientation
fn orientation(&self) -> GridOrientation
Get the grid orientation (horizontal or vertical)
Source§fn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Check if the grid is visible
Source§fn set_visible(&mut self, visible: bool)
fn set_visible(&mut self, visible: bool)
Set grid visibility
Source§fn calculate_positions(&self, _viewport: Rectangle) -> Vec<i32, 64>
fn calculate_positions(&self, _viewport: Rectangle) -> Vec<i32, 64>
Calculate the positions where grid lines should be drawn
Returns a vector of positions in screen coordinates
Source§fn set_spacing(&mut self, _spacing: f32)
fn set_spacing(&mut self, _spacing: f32)
Set the spacing between grid lines
Auto Trait Implementations§
impl<C> Freeze for CustomGrid<C>where
C: Freeze,
impl<C> RefUnwindSafe for CustomGrid<C>where
C: RefUnwindSafe,
impl<C> Send for CustomGrid<C>where
C: Send,
impl<C> Sync for CustomGrid<C>where
C: Sync,
impl<C> Unpin for CustomGrid<C>where
C: Unpin,
impl<C> UnwindSafe for CustomGrid<C>where
C: UnwindSafe,
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.