pub trait Grid<C: PixelColor> {
// Required methods
fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>
where D: DrawTarget<Color = C>;
fn orientation(&self) -> GridOrientation;
fn is_visible(&self) -> bool;
fn set_visible(&mut self, visible: bool);
fn style(&self) -> &GridStyle<C>;
fn set_style(&mut self, style: GridStyle<C>);
fn calculate_positions(&self, viewport: Rectangle) -> Vec<i32, 64>;
fn spacing(&self) -> f32;
fn set_spacing(&mut self, spacing: f32);
fn as_any(&self) -> &dyn Any;
}Expand description
Core trait for all grid types
Required Methods§
Sourcefn 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
§Arguments
viewport- The area to draw the grid intarget- The display target to draw to
Sourcefn orientation(&self) -> GridOrientation
fn orientation(&self) -> GridOrientation
Get the grid orientation (horizontal or vertical)
Sourcefn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Check if the grid is visible
Sourcefn set_visible(&mut self, visible: bool)
fn set_visible(&mut self, visible: bool)
Set grid visibility
Sourcefn 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
Sourcefn set_spacing(&mut self, spacing: f32)
fn set_spacing(&mut self, spacing: f32)
Set the spacing between grid lines
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.