pub trait Axis<T, C: PixelColor> {
type TickGenerator: TickGenerator<T>;
type Style;
// Required methods
fn min(&self) -> T;
fn max(&self) -> T;
fn orientation(&self) -> AxisOrientation;
fn position(&self) -> AxisPosition;
fn transform_value(&self, value: T, viewport: Rectangle) -> i32;
fn inverse_transform(&self, coordinate: i32, viewport: Rectangle) -> T;
fn tick_generator(&self) -> &Self::TickGenerator;
fn style(&self) -> &Self::Style;
fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>
where D: DrawTarget<Color = C>;
fn required_space(&self) -> u32;
}Expand description
Core trait for all axis types
Required Associated Types§
Sourcetype TickGenerator: TickGenerator<T>
type TickGenerator: TickGenerator<T>
The tick generator type for this axis
Required Methods§
Sourcefn orientation(&self) -> AxisOrientation
fn orientation(&self) -> AxisOrientation
Get the axis orientation
Sourcefn position(&self) -> AxisPosition
fn position(&self) -> AxisPosition
Get the axis position
Sourcefn transform_value(&self, value: T, viewport: Rectangle) -> i32
fn transform_value(&self, value: T, viewport: Rectangle) -> i32
Transform a data value to screen coordinate
§Arguments
value- The data value to transformviewport- The available drawing area
Sourcefn inverse_transform(&self, coordinate: i32, viewport: Rectangle) -> T
fn inverse_transform(&self, coordinate: i32, viewport: Rectangle) -> T
Transform a screen coordinate back to data value
§Arguments
coordinate- The screen coordinateviewport- The available drawing area
Sourcefn tick_generator(&self) -> &Self::TickGenerator
fn tick_generator(&self) -> &Self::TickGenerator
Get the tick generator for this axis
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 axis to the target
§Arguments
viewport- The area to draw the axis intarget- The display target to draw to
Sourcefn required_space(&self) -> u32
fn required_space(&self) -> u32
Calculate the space required for this axis (labels, ticks, etc.)
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.