pub struct PlotBuilder<T: Plottable + Graph> { /* private fields */ }Expand description
A builder for creating and configuring data visualizations.
PlotBuilder provides a fluent interface for customizing plots with various
styling and labeling options. It works with any type that implements the
Plottable trait, allowing for consistent visualization capabilities across
different data structures.
This builder is typically created via the plot() method on types that implement
the Plottable trait. After configuring the plot with the desired options,
it can be rendered and saved using the methods from PlotBuilderExt.
Implementations§
Source§impl<T: Plottable + Graph> PlotBuilder<T>
impl<T: Plottable + Graph> PlotBuilder<T>
Sourcepub fn line_style(self, line_style: LineStyle) -> Self
pub fn line_style(self, line_style: LineStyle) -> Self
Sourcepub fn legend(self, legend: Vec<impl Into<String>>) -> Self
pub fn legend(self, legend: Vec<impl Into<String>>) -> Self
Sets the legend for the current instance.
This method accepts a vector of items that can be converted into strings and sets the legend
field of the current instance’s options. It returns the modified instance for further chaining.
§Arguments
legend- AVeccontaining items that implement theInto<String>trait. Each element will be converted into aStringand assigned to the legend.
§Returns
Returns the modified instance with the legend updated.
In this example, the legend is updated to include “Item 1”, “Item 2”, and “Item 3”.
Sourcepub fn add_legend(self, legend: impl Into<String>) -> Self
pub fn add_legend(self, legend: impl Into<String>) -> Self
Adds a legend entry to the existing legend configuration or initializes a new legend with the provided entry if none exists.
This method allows chaining, modifying the legend configuration within the options
of the current object. If a legend already exists, the provided legend entry will
be appended to it. If no legend exists, a new legend will be created containing the
provided entry.
§Arguments
legend- An item implementingInto<String>that represents the legend entry to add.
§Returns
Returns Self (the modified object) to allow method chaining.
In this example, two legend entries, "Legend 1" and "Legend 2", are added to the chart’s
legend configuration.
Sourcepub fn dimensions(self, width: u32, height: u32) -> Self
pub fn dimensions(self, width: u32, height: u32) -> Self
Sourcepub fn color_scheme(self, color_scheme: ColorScheme) -> Self
pub fn color_scheme(self, color_scheme: ColorScheme) -> Self
Sets the color scheme for the current instance.
This method allows you to specify a ColorScheme to customize the appearance or theme
of the associated object. The method updates the color_scheme field in the options
struct with the provided value and returns an updated instance of self.
§Parameters
color_scheme: The desiredColorSchemeto be applied. This defines the visual style or theme to be used by the object.
§Returns
An updated instance of Self with the new color scheme applied.
Sourcepub fn show_legend(self, show_legend: bool) -> Self
pub fn show_legend(self, show_legend: bool) -> Self
Sets the visibility of the legend in the chart or visualization.
§Parameters
show_legend: A boolean specifying whether the legend should be displayed.true: The legend will be displayed.false: The legend will be hidden.
§Returns
- Returns an updated instance of
Selfwith theshow_legendoption set according to the provided parameter.
Trait Implementations§
Source§impl<T: Plottable + Graph> Graph for PlotBuilder<T>
impl<T: Plottable + Graph> Graph for PlotBuilder<T>
Source§fn graph_data(&self) -> GraphData
fn graph_data(&self) -> GraphData
Source§fn graph_config(&self) -> GraphConfig
fn graph_config(&self) -> GraphConfig
Auto Trait Implementations§
impl<T> Freeze for PlotBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for PlotBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for PlotBuilder<T>where
T: Send,
impl<T> Sync for PlotBuilder<T>where
T: Sync,
impl<T> Unpin for PlotBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for PlotBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.