Chart

Trait Chart 

Source
pub trait Chart<C: PixelColor> {
    type Data: DataSeries;
    type Config;

    // Required method
    fn draw<D>(
        &self,
        data: &Self::Data,
        config: &Self::Config,
        viewport: Rectangle,
        target: &mut D,
    ) -> ChartResult<()>
       where D: DrawTarget<Color = C>;

    // Provided method
    fn data_bounds(&self, _data: &Self::Data) -> ChartResult<()> { ... }
}
Expand description

Main trait for all chart types

Required Associated Types§

Source

type Data: DataSeries

The type of data this chart can render

Source

type Config

Configuration type for this chart

Required Methods§

Source

fn draw<D>( &self, data: &Self::Data, config: &Self::Config, viewport: Rectangle, target: &mut D, ) -> ChartResult<()>
where D: DrawTarget<Color = C>,

Draw the chart to the target display

§Arguments
  • data - The data to render
  • config - Chart configuration
  • viewport - The area to draw the chart in
  • target - The display target to draw to

Provided Methods§

Source

fn data_bounds(&self, _data: &Self::Data) -> ChartResult<()>

Get the data bounds for this chart

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.

Implementors§

Source§

impl<C> Chart<C> for AnimatedBarChart<C>
where C: From<Rgb565> + PixelColor,

Available on crate feature animations only.
Source§

impl<C> Chart<C> for BarChart<C>
where C: From<Rgb565> + PixelColor,

Source§

impl<C> Chart<C> for CurveChart<C>
where C: From<Rgb565> + PixelColor + 'static,

Source§

impl<C> Chart<C> for AnimatedLineChart<C>
where C: From<Rgb565> + PixelColor + 'static,

Available on crate feature animations only.
Source§

impl<C> Chart<C> for LineChart<C>
where C: From<Rgb565> + PixelColor + 'static,

Source§

impl<C> Chart<C> for PieChart<C>
where C: From<Rgb565> + PixelColor,