[][src]Struct plotters::prelude::ChartContext

pub struct ChartContext<'a, DB: DrawingBackend, CT: CoordTranslate> { /* fields omitted */ }

The context of the chart. This is the core object of Plotters. Any plot/chart is abstracted as this type, and any data series can be placed to the chart context.

Methods

impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>[src]

pub fn into_chart_state(self) -> ChartState<CT>[src]

Convert a chart context into a chart state, by doing so, the chart context is consumed and a saved chart state is created for later use.

pub fn into_shared_chart_state(self) -> ChartState<Arc<CT>>[src]

Convert the chart context into a sharable chart state. Normally a chart state can not be clone, since the coordinate spec may not be able to be cloned. In this case, we can use an Arc get the coordinate wrapped thus the state can be cloned and shared by multiple chart context

impl<'a, DB: DrawingBackend, CT: CoordTranslate + Clone> ChartContext<'a, DB, CT>[src]

pub fn to_chart_state(&self) -> ChartState<CT>[src]

Make the chart context, do not consume the chart context and clone the coordinate spec

impl<'a, DB: DrawingBackend, XT: Debug, YT: Debug, X: Ranged<ValueType = XT>, Y: Ranged<ValueType = YT>> ChartContext<'a, DB, RangedCoord<X, Y>>[src]

pub fn configure_mesh<'b>(&'b mut self) -> MeshStyle<'a, 'b, X, Y, DB>[src]

Initialize a mesh configuration object and mesh drawing can be finalized by calling the function MeshStyle::draw

impl<'a, DB: DrawingBackend + 'a, CT: CoordTranslate> ChartContext<'a, DB, CT>[src]

pub fn configure_series_labels<'b>(
    &'b mut self
) -> SeriesLabelStyle<'a, 'b, DB, CT>
[src]

Configure the styles for drawing series labels in the chart

pub fn plotting_area(&self) -> &DrawingArea<DB, CT>[src]

Get a reference of underlying plotting area

impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>[src]

pub fn as_coord_spec(&self) -> &CT[src]

impl<'a, DB: DrawingBackend, CT: ReverseCoordTranslate> ChartContext<'a, DB, CT>[src]

pub fn into_coord_trans(self) -> impl Fn(BackendCoord) -> Option<CT::From>[src]

Convert the chart context into an closure that can be used for coordinate translation

impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, Arc<RangedCoord<X, Y>>>[src]

pub fn draw_series<E, R, S>(
    &mut self,
    series: S
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>> where
    &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
    E: Drawable<DB>,
    R: Borrow<E>,
    S: IntoIterator<Item = R>, 
[src]

Draw a data series. A data series in Plotters is abstracted as an iterator of elements

impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, RangedCoord<X, Y>>[src]

pub fn x_range(&self) -> Range<X::ValueType>[src]

Get the range of X axis

pub fn y_range(&self) -> Range<Y::ValueType>[src]

Get range of the Y axis

pub fn backend_coord(
    &self,
    coord: &(X::ValueType, Y::ValueType)
) -> BackendCoord
[src]

Maps the coordinate to the backend coordinate. This is typically used with an interactive chart.

pub fn draw_series<E, R, S>(
    &mut self,
    series: S
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>> where
    &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
    E: Drawable<DB>,
    R: Borrow<E>,
    S: IntoIterator<Item = R>, 
[src]

Draw a data series. A data series in Plotters is abstracted as an iterator of elements

pub fn set_secondary_coord<SX: AsRangedCoord, SY: AsRangedCoord>(
    self,
    x_coord: SX,
    y_coord: SY
) -> DualCoordChartContext<'a, DB, RangedCoord<X, Y>, RangedCoord<SX::CoordDescType, SY::CoordDescType>>
[src]

Convert this chart context into a dual axis chart context

  • x_coord: The coordinate spec for the X axis
  • y_coord: The coordinate spec for the Y axis
  • returns The newly created dual spec chart context

Trait Implementations

impl<'a, DB: DrawingBackend, CT: CoordTranslate> From<ChartContext<'a, DB, CT>> for ChartState<CT>[src]

impl<'a, 'b, '_, DB, CT> From<&'_ ChartContext<'a, DB, CT>> for ChartState<CT> where
    DB: DrawingBackend,
    CT: CoordTranslate + Clone
[src]

impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> BorrowMut<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>[src]

impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> Borrow<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>[src]

Auto Trait Implementations

impl<'a, DB, CT> !Send for ChartContext<'a, DB, CT>

impl<'a, DB, CT> Unpin for ChartContext<'a, DB, CT> where
    CT: Unpin,
    DB: Unpin

impl<'a, DB, CT> !Sync for ChartContext<'a, DB, CT>

impl<'a, DB, CT> !UnwindSafe for ChartContext<'a, DB, CT>

impl<'a, DB, CT> !RefUnwindSafe for ChartContext<'a, DB, CT>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]