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§
Sourcetype Data: DataSeries
type Data: DataSeries
The type of data this chart can render
Required Methods§
Sourcefn draw<D>(
&self,
data: &Self::Data,
config: &Self::Config,
viewport: Rectangle,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
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 renderconfig- Chart configurationviewport- The area to draw the chart intarget- The display target to draw to
Provided Methods§
Sourcefn data_bounds(&self, _data: &Self::Data) -> ChartResult<()>
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>
Available on crate feature animations only.
impl<C> Chart<C> for AnimatedBarChart<C>
Available on crate feature
animations only.type Data = StaticDataSeries<Point2D, 256>
type Config = ChartConfig<C>
Source§impl<C> Chart<C> for BarChart<C>
impl<C> Chart<C> for BarChart<C>
type Data = StaticDataSeries<Point2D, 256>
type Config = ChartConfig<C>
Source§impl<C> Chart<C> for CurveChart<C>
impl<C> Chart<C> for CurveChart<C>
type Data = StaticDataSeries<Point2D, 256>
type Config = ChartConfig<C>
Source§impl<C> Chart<C> for AnimatedLineChart<C>
Available on crate feature animations only.
impl<C> Chart<C> for AnimatedLineChart<C>
Available on crate feature
animations only.