pub struct ChartContext<'a, DB: DrawingBackend, CT: CoordTranslate> { /* private fields */ }Expand description
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.
Implementations§
Source§impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>
impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>
Sourcepub fn into_chart_state(self) -> ChartState<CT>
pub fn into_chart_state(self) -> ChartState<CT>
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.
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
Source§impl<'a, DB: DrawingBackend, CT: CoordTranslate + Clone> ChartContext<'a, DB, CT>
impl<'a, DB: DrawingBackend, CT: CoordTranslate + Clone> ChartContext<'a, DB, CT>
Sourcepub fn to_chart_state(&self) -> ChartState<CT>
pub fn to_chart_state(&self) -> ChartState<CT>
Make the chart context, do not consume the chart context and clone the coordinate spec
Source§impl<'a, DB: DrawingBackend, XT: Debug, YT: Debug, X: Ranged<ValueType = XT>, Y: Ranged<ValueType = YT>> ChartContext<'a, DB, RangedCoord<X, Y>>
impl<'a, DB: DrawingBackend, XT: Debug, YT: Debug, X: Ranged<ValueType = XT>, Y: Ranged<ValueType = YT>> ChartContext<'a, DB, RangedCoord<X, Y>>
Sourcepub fn configure_mesh<'b>(&'b mut self) -> MeshStyle<'a, 'b, X, Y, DB>
pub fn configure_mesh<'b>(&'b mut self) -> MeshStyle<'a, 'b, X, Y, DB>
Initialize a mesh configuration object and mesh drawing can be finalized by calling
the function MeshStyle::draw
Source§impl<'a, DB: DrawingBackend + 'a, CT: CoordTranslate> ChartContext<'a, DB, CT>
impl<'a, DB: DrawingBackend + 'a, CT: CoordTranslate> ChartContext<'a, DB, CT>
Sourcepub fn configure_series_labels<'b>(
&'b mut self,
) -> SeriesLabelStyle<'a, 'b, DB, CT>
pub fn configure_series_labels<'b>( &'b mut self, ) -> SeriesLabelStyle<'a, 'b, DB, CT>
Configure the styles for drawing series labels in the chart
Sourcepub fn plotting_area(&self) -> &DrawingArea<DB, CT>
pub fn plotting_area(&self) -> &DrawingArea<DB, CT>
Get a reference of underlying plotting area
Source§impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>
impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT>
pub fn as_coord_spec(&self) -> &CT
Source§impl<'a, DB: DrawingBackend, CT: ReverseCoordTranslate> ChartContext<'a, DB, CT>
impl<'a, DB: DrawingBackend, CT: ReverseCoordTranslate> ChartContext<'a, DB, CT>
Sourcepub fn into_coord_trans(self) -> impl Fn(BackendCoord) -> Option<CT::From>
pub fn into_coord_trans(self) -> impl Fn(BackendCoord) -> Option<CT::From>
Convert the chart context into an closure that can be used for coordinate translation
Source§impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, Arc<RangedCoord<X, Y>>>
impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, Arc<RangedCoord<X, Y>>>
Sourcepub fn draw_series<E, R, S>(
&mut self,
series: S,
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>>where
for<'b> &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
E: Drawable<DB>,
R: Borrow<E>,
S: IntoIterator<Item = R>,
pub fn draw_series<E, R, S>(
&mut self,
series: S,
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>>where
for<'b> &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
E: Drawable<DB>,
R: Borrow<E>,
S: IntoIterator<Item = R>,
Draw a data series. A data series in Plotters is abstracted as an iterator of elements
Source§impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, RangedCoord<X, Y>>
impl<'a, DB: DrawingBackend, X: Ranged, Y: Ranged> ChartContext<'a, DB, RangedCoord<X, Y>>
Sourcepub fn backend_coord(
&self,
coord: &(X::ValueType, Y::ValueType),
) -> BackendCoord
pub fn backend_coord( &self, coord: &(X::ValueType, Y::ValueType), ) -> BackendCoord
Maps the coordinate to the backend coordinate. This is typically used with an interactive chart.
Sourcepub fn draw_series<E, R, S>(
&mut self,
series: S,
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>>where
for<'b> &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
E: Drawable<DB>,
R: Borrow<E>,
S: IntoIterator<Item = R>,
pub fn draw_series<E, R, S>(
&mut self,
series: S,
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>>where
for<'b> &'b E: PointCollection<'b, (X::ValueType, Y::ValueType)>,
E: Drawable<DB>,
R: Borrow<E>,
S: IntoIterator<Item = R>,
Draw a data series. A data series in Plotters is abstracted as an iterator of elements
Sourcepub 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>>
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>>
Convert this chart context into a dual axis chart context
x_coord: The coordinate spec for the X axisy_coord: The coordinate spec for the Y axis- returns The newly created dual spec chart context
Trait Implementations§
Source§impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> Borrow<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>
impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> Borrow<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>
Source§fn borrow(&self) -> &ChartContext<'a, DB, CT1>
fn borrow(&self) -> &ChartContext<'a, DB, CT1>
Source§impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> BorrowMut<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>
impl<'a, DB: DrawingBackend, CT1: CoordTranslate, CT2: CoordTranslate> BorrowMut<ChartContext<'a, DB, CT1>> for DualCoordChartContext<'a, DB, CT1, CT2>
Source§fn borrow_mut(&mut self) -> &mut ChartContext<'a, DB, CT1>
fn borrow_mut(&mut self) -> &mut ChartContext<'a, DB, CT1>
Source§impl<'a, 'b, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
impl<'a, 'b, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
Source§fn from(chart: &ChartContext<'a, DB, CT>) -> ChartState<CT>
fn from(chart: &ChartContext<'a, DB, CT>) -> ChartState<CT>
Source§impl<'a, DB: DrawingBackend, CT: CoordTranslate> From<ChartContext<'a, DB, CT>> for ChartState<CT>
impl<'a, DB: DrawingBackend, CT: CoordTranslate> From<ChartContext<'a, DB, CT>> for ChartState<CT>
Source§fn from(chart: ChartContext<'a, DB, CT>) -> ChartState<CT>
fn from(chart: ChartContext<'a, DB, CT>) -> ChartState<CT>
Auto Trait Implementations§
impl<'a, DB, CT> Freeze for ChartContext<'a, DB, CT>where
CT: Freeze,
impl<'a, DB, CT> !RefUnwindSafe for ChartContext<'a, DB, CT>
impl<'a, DB, CT> !Send for ChartContext<'a, DB, CT>
impl<'a, DB, CT> !Sync for ChartContext<'a, DB, CT>
impl<'a, DB, CT> Unpin for ChartContext<'a, DB, CT>
impl<'a, DB, CT> !UnwindSafe for ChartContext<'a, DB, CT>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains the unclamped color. Read more