pub struct Pie<P>{ /* private fields */ }
Expand description
Construct a Pie Chart trace.
§Examples
use plotly::Pie;
let trace = Pie::new(
vec![2, 3, 5]);
let expected = serde_json::json!({
"type": "pie",
"values": [2, 3, 5],
});
assert_eq!(serde_json::to_value(trace).unwrap(), expected);
§Using only labels
Build a new Pie Chart by only assigning the labels field. The Pie chart
will be generated by counting the number of unique labels, see Pie::labels
field description. Note that to create a Pie chart by using this
function, the type parameter P
needs to be specialized, this can be
done by doing
use plotly::Pie;
let labels = ["giraffes", "giraffes", "orangutans", "monkeys"];
let trace = Pie::<u32>::from_labels(&labels);
let expected = serde_json::json!({
"type": "pie",
"labels": ["giraffes", "giraffes", "orangutans", "monkeys"],
});
assert_eq!(serde_json::to_value(trace).unwrap(), expected);
Implementations§
Source§impl<P> Pie<P>
impl<P> Pie<P>
pub fn domain(self, value: Domain) -> Box<Self>
Sourcepub fn modify_all_domain(value: Domain) -> RestylePie<P>
pub fn modify_all_domain(value: Domain) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_domain(values: Vec<Domain>) -> RestylePie<P>
pub fn modify_domain(values: Vec<Domain>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn automargin(self, value: bool) -> Box<Self>
pub fn automargin(self, value: bool) -> Box<Self>
Determines whether outside text labels can push the margins.
Sourcepub fn modify_all_automargin(value: bool) -> RestylePie<P>
pub fn modify_all_automargin(value: bool) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_automargin(values: Vec<bool>) -> RestylePie<P>
pub fn modify_automargin(values: Vec<bool>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn custom_data(
self,
value: Vec<impl Into<NumOrString> + Clone>,
) -> Box<Self>
pub fn custom_data( self, value: Vec<impl Into<NumOrString> + Clone>, ) -> Box<Self>
Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, “scatter” traces also appends customdata items in the markers DOM elements
Sourcepub fn modify_all_custom_data(
value: Vec<impl Into<NumOrString> + Clone>,
) -> RestylePie<P>
pub fn modify_all_custom_data( value: Vec<impl Into<NumOrString> + Clone>, ) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_custom_data(
values: Vec<Vec<impl Into<NumOrString> + Clone>>,
) -> RestylePie<P>
pub fn modify_custom_data( values: Vec<Vec<impl Into<NumOrString> + Clone>>, ) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn direction(self, value: PieDirection) -> Box<Self>
pub fn direction(self, value: PieDirection) -> Box<Self>
Specifies the direction at which succeeding sectors follow one another. The ‘direction’ property is an enumeration that may be specified as One of the following enumeration values: [‘clockwise’, ‘counterclockwise’]
Sourcepub fn modify_all_direction(value: PieDirection) -> RestylePie<P>
pub fn modify_all_direction(value: PieDirection) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_direction(values: Vec<PieDirection>) -> RestylePie<P>
pub fn modify_direction(values: Vec<PieDirection>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn modify_all_dlabel(value: f64) -> RestylePie<P>
pub fn modify_all_dlabel(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_dlabel(values: Vec<f64>) -> RestylePie<P>
pub fn modify_dlabel(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hole(self, value: f64) -> Box<Self>
pub fn hole(self, value: f64) -> Box<Self>
Sets the fraction of the radius to cut out of the pie. Use this to make a donut chart. The ‘hole’ property is a number and may be specified as a value in the interval [0, 1]
Sourcepub fn modify_all_hole(value: f64) -> RestylePie<P>
pub fn modify_all_hole(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hole(values: Vec<f64>) -> RestylePie<P>
pub fn modify_hole(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_info(self, value: HoverInfo) -> Box<Self>
pub fn hover_info(self, value: HoverInfo) -> Box<Self>
Determines which trace information appear on hover. If none or skip are set, no information is displayed upon hovering. But, if none is set, click and hover events are still fired.
Sourcepub fn modify_all_hover_info(value: HoverInfo) -> RestylePie<P>
pub fn modify_all_hover_info(value: HoverInfo) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_info(values: Vec<HoverInfo>) -> RestylePie<P>
pub fn modify_hover_info(values: Vec<HoverInfo>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
pub fn hover_label(self, value: Label) -> Box<Self>
Sourcepub fn modify_all_hover_label(value: Label) -> RestylePie<P>
pub fn modify_all_hover_label(value: Label) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_label(values: Vec<Label>) -> RestylePie<P>
pub fn modify_hover_label(values: Vec<Label>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_template(self, value: impl AsRef<str>) -> Box<Self>
pub fn hover_template(self, value: impl AsRef<str>) -> Box<Self>
Template string used for rendering the information that appear on hover
box. Note that this will override hoverinfo. Variables are inserted
using %{variable}, for example “y: %{y}” as well as %{xother},
{%xother}, {%xother}, {%xother}. When showing info for several
points, “xother” will be added to those with different x positions from
the first point. An underscore before or after “(x|y)other” will add
a space on that side, only when this field is shown. Numbers are
formatted using d3-format’s syntax %{variable:d3-format}, for example
“Price: %{y:$.2f}”. https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax.
Dates are formatted using d3-time-format’s syntax
%{variable|d3-time-format}, for example “Day: %{2019-01-01|%A}”. https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for
details on the date formatting syntax. The variables available in
hovertemplate are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data.
Additionally, every attributes that can be specified per-point (the
ones that are arrayOk: true) are available. Finally, the template
string has access to variables label, color, value, percent and text.
Anything contained in tag <extra> is displayed in the secondary box,
for example “
Sourcepub fn modify_all_hover_template(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_hover_template(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_template(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_hover_template(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_template_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn hover_template_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Template string used for rendering the information that appear on hover
box. Note that this will override hoverinfo. Variables are inserted
using %{variable}, for example “y: %{y}” as well as %{xother},
{%xother}, {%xother}, {%xother}. When showing info for several
points, “xother” will be added to those with different x positions from
the first point. An underscore before or after “(x|y)other” will add
a space on that side, only when this field is shown. Numbers are
formatted using d3-format’s syntax %{variable:d3-format}, for example
“Price: %{y:$.2f}”. https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax.
Dates are formatted using d3-time-format’s syntax
%{variable|d3-time-format}, for example “Day: %{2019-01-01|%A}”. https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for
details on the date formatting syntax. The variables available in
hovertemplate are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data.
Additionally, every attributes that can be specified per-point (the
ones that are arrayOk: true) are available. Finally, the template
string has access to variables label, color, value, percent and text.
Anything contained in tag <extra> is displayed in the secondary box,
for example “
Sourcepub fn hover_text(self, value: impl AsRef<str>) -> Box<Self>
pub fn hover_text(self, value: impl AsRef<str>) -> Box<Self>
Sets hover text elements associated with each sector. If a single string, the same string appears for all data points. If an array of string, the items are mapped in order of this trace’s sectors. To be seen, trace hoverinfo must contain a “text” flag.
Sourcepub fn modify_all_hover_text(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_hover_text(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_text(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_hover_text(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_text_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn hover_text_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets hover text elements associated with each sector. If a single string, the same string appears for all data points. If an array of string, the items are mapped in order of this trace’s sectors. To be seen, trace hoverinfo must contain a “text” flag.
Sourcepub fn ids(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn ids(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.
Sourcepub fn modify_all_ids(value: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_all_ids(value: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_ids(values: Vec<Vec<impl AsRef<str>>>) -> RestylePie<P>
pub fn modify_ids(values: Vec<Vec<impl AsRef<str>>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn inside_text_font(self, value: Font) -> Box<Self>
pub fn inside_text_font(self, value: Font) -> Box<Self>
Sets the font used for textinfo lying inside the sector.
Sourcepub fn modify_all_inside_text_font(value: Font) -> RestylePie<P>
pub fn modify_all_inside_text_font(value: Font) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_inside_text_font(values: Vec<Font>) -> RestylePie<P>
pub fn modify_inside_text_font(values: Vec<Font>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn inside_text_orientation(self, value: Orientation) -> Box<Self>
pub fn inside_text_orientation(self, value: Orientation) -> Box<Self>
Controls the orientation of the text inside chart sectors. When set to “auto”, text may be oriented in any direction in order to be as big as possible in the middle of a sector. The “horizontal” option orients text to be parallel with the bottom of the chart, and may make text smaller in order to achieve that goal. The “radial” option orients text along the radius of the sector. The “tangential” option orients text perpendicular to the radius of the sector.
Sourcepub fn modify_all_inside_text_orientation(value: Orientation) -> RestylePie<P>
pub fn modify_all_inside_text_orientation(value: Orientation) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_inside_text_orientation(values: Vec<Orientation>) -> RestylePie<P>
pub fn modify_inside_text_orientation(values: Vec<Orientation>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn label0(self, value: f64) -> Box<Self>
pub fn label0(self, value: f64) -> Box<Self>
Alternate to labels. Builds a numeric set of labels. Use with dlabel where label0 is the starting label and dlabel the step.
Sourcepub fn modify_all_label0(value: f64) -> RestylePie<P>
pub fn modify_all_label0(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_label0(values: Vec<f64>) -> RestylePie<P>
pub fn modify_label0(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn labels(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn labels(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the sector labels. If labels entries are duplicated, we sum associated values or simply count occurrences if values is not provided. For other array attributes (including color) we use the first non-empty entry among all occurrences of the label.
Sourcepub fn modify_all_labels(value: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_all_labels(value: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_labels(values: Vec<Vec<impl AsRef<str>>>) -> RestylePie<P>
pub fn modify_labels(values: Vec<Vec<impl AsRef<str>>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn legend_group(self, value: impl AsRef<str>) -> Box<Self>
pub fn legend_group(self, value: impl AsRef<str>) -> Box<Self>
Sets the legend group for this trace. Traces part of the same legend group show/hide at the same time when toggling legend items.
Sourcepub fn modify_all_legend_group(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_legend_group(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_legend_group(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_legend_group(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn legend_group_title(self, value: impl Into<LegendGroupTitle>) -> Box<Self>
pub fn legend_group_title(self, value: impl Into<LegendGroupTitle>) -> Box<Self>
Set and style the title to appear for the legend group.
Sourcepub fn modify_all_legend_group_title(
value: impl Into<LegendGroupTitle>,
) -> RestylePie<P>
pub fn modify_all_legend_group_title( value: impl Into<LegendGroupTitle>, ) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_legend_group_title(
values: Vec<impl Into<LegendGroupTitle>>,
) -> RestylePie<P>
pub fn modify_legend_group_title( values: Vec<impl Into<LegendGroupTitle>>, ) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn legend_rank(self, value: usize) -> Box<Self>
pub fn legend_rank(self, value: usize) -> Box<Self>
Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with “reversed” legend.traceorder they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items. When having unranked or equal rank items shapes would be displayed after traces i.e. according to their order in data and layout.
Sourcepub fn modify_all_legend_rank(value: usize) -> RestylePie<P>
pub fn modify_all_legend_rank(value: usize) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_legend_rank(values: Vec<usize>) -> RestylePie<P>
pub fn modify_legend_rank(values: Vec<usize>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
pub fn marker(self, value: Marker) -> Box<Self>
Sourcepub fn modify_all_marker(value: Marker) -> RestylePie<P>
pub fn modify_all_marker(value: Marker) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_marker(values: Vec<Marker>) -> RestylePie<P>
pub fn modify_marker(values: Vec<Marker>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn meta(self, value: impl Into<NumOrString>) -> Box<Self>
pub fn meta(self, value: impl Into<NumOrString>) -> Box<Self>
Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace name, graph, axis and colorbar title.text, annotation text rangeselector, updatemenues and sliders label text all support meta. To access the trace meta values in an attribute in the same trace, simply use %{meta[i]} where i is the index or key of the meta item in question. To access trace meta in layout attributes, use %{data[n[.meta[i]} where i is the index or key of the meta and n is the trace index.
Sourcepub fn modify_all_meta(value: impl Into<NumOrString>) -> RestylePie<P>
pub fn modify_all_meta(value: impl Into<NumOrString>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_meta(values: Vec<impl Into<NumOrString>>) -> RestylePie<P>
pub fn modify_meta(values: Vec<impl Into<NumOrString>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn name(self, value: impl AsRef<str>) -> Box<Self>
pub fn name(self, value: impl AsRef<str>) -> Box<Self>
Sets the trace name. The trace name appears as the legend item and on hover.
Sourcepub fn modify_all_name(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_name(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_name(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_name(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn modify_all_opacity(value: f64) -> RestylePie<P>
pub fn modify_all_opacity(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_opacity(values: Vec<f64>) -> RestylePie<P>
pub fn modify_opacity(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn outside_text_font(self, value: Font) -> Box<Self>
pub fn outside_text_font(self, value: Font) -> Box<Self>
Sets the font used for textinfo lying outside the sector.
Sourcepub fn modify_all_outside_text_font(value: Font) -> RestylePie<P>
pub fn modify_all_outside_text_font(value: Font) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_outside_text_font(values: Vec<Font>) -> RestylePie<P>
pub fn modify_outside_text_font(values: Vec<Font>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn rotation(self, value: f64) -> Box<Self>
pub fn rotation(self, value: f64) -> Box<Self>
Instead of the first slice starting at 12 o’clock, rotate to some other angle. The ‘rotation’ property is a angle (in degrees) that may be specified as a number between -180 and 180. Numeric values outside this range are converted to the equivalent value (e.g. 270 is converted to -90).
Sourcepub fn modify_all_rotation(value: f64) -> RestylePie<P>
pub fn modify_all_rotation(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_rotation(values: Vec<f64>) -> RestylePie<P>
pub fn modify_rotation(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn show_legend(self, value: bool) -> Box<Self>
pub fn show_legend(self, value: bool) -> Box<Self>
Determines whether or not an item corresponding to this trace is shown in the legend.
Sourcepub fn modify_all_show_legend(value: bool) -> RestylePie<P>
pub fn modify_all_show_legend(value: bool) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_show_legend(values: Vec<bool>) -> RestylePie<P>
pub fn modify_show_legend(values: Vec<bool>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn sort(self, value: bool) -> Box<Self>
pub fn sort(self, value: bool) -> Box<Self>
Determines whether or not the sectors are reordered from largest to smallest.
Sourcepub fn modify_all_sort(value: bool) -> RestylePie<P>
pub fn modify_all_sort(value: bool) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_sort(values: Vec<bool>) -> RestylePie<P>
pub fn modify_sort(values: Vec<bool>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text(self, value: impl AsRef<str>) -> Box<Self>
pub fn text(self, value: impl AsRef<str>) -> Box<Self>
Sets text elements associated with each sector. If trace textinfo contains a “text” flag, these elements will be seen on the chart. If trace hoverinfo contains a “text” flag and “hovertext” is not set, these elements will be seen in the hover labels.
Sourcepub fn modify_all_text(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn text_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets text elements associated with each sector. If trace textinfo contains a “text” flag, these elements will be seen on the chart. If trace hoverinfo contains a “text” flag and “hovertext” is not set, these elements will be seen in the hover labels.
Sourcepub fn text_info(self, value: impl AsRef<str>) -> Box<Self>
pub fn text_info(self, value: impl AsRef<str>) -> Box<Self>
Determines which trace information appear on the graph.
Sourcepub fn modify_all_text_info(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text_info(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_info(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text_info(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn modify_all_text_font(value: Font) -> RestylePie<P>
pub fn modify_all_text_font(value: Font) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_font(values: Vec<Font>) -> RestylePie<P>
pub fn modify_text_font(values: Vec<Font>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_position(self, value: Position) -> Box<Self>
pub fn text_position(self, value: Position) -> Box<Self>
Specifies the location of the textinfo.
Sourcepub fn modify_all_text_position(value: Position) -> RestylePie<P>
pub fn modify_all_text_position(value: Position) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_position(values: Vec<Position>) -> RestylePie<P>
pub fn modify_text_position(values: Vec<Position>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_position_array(self, value: Vec<Position>) -> Box<Self>
pub fn text_position_array(self, value: Vec<Position>) -> Box<Self>
Specifies the location of the textinfo.
Sourcepub fn text_template(self, value: impl AsRef<str>) -> Box<Self>
pub fn text_template(self, value: impl AsRef<str>) -> Box<Self>
Template string used for rendering the information text that appear on points. Note that this will override textinfo. Variables are inserted using %{variable}, for example “y: %{y}”. Numbers are formatted using d3-format’s syntax %{variable:d3-format}, for example “Price: %{y:$.2f}”. https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format’s syntax %{variable|d3-time-format}, for example “Day: %{2019-01-01|%A}”. https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are arrayOk: true) are available. Finally, the template string has access to variables label, color, value, percent and text.
Sourcepub fn modify_all_text_template(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text_template(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_template(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text_template(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_template_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn text_template_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Template string used for rendering the information text that appear on points. Note that this will override textinfo. Variables are inserted using %{variable}, for example “y: %{y}”. Numbers are formatted using d3-format’s syntax %{variable:d3-format}, for example “Price: %{y:$.2f}”. https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format’s syntax %{variable|d3-time-format}, for example “Day: %{2019-01-01|%A}”. https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are arrayOk: true) are available. Finally, the template string has access to variables label, color, value, percent and text.
Sourcepub fn ui_revision(self, value: impl Into<NumOrString>) -> Box<Self>
pub fn ui_revision(self, value: impl Into<NumOrString>) -> Box<Self>
Controls persistence of some user-driven changes to the trace: constraintrange in parcoords traces, as well as some editable: true modifications such as name and colorbar.title. Defaults to layout.uirevision. Note that other user-driven trace attribute changes are controlled by layout attributes: trace.visible is controlled by layout.legend.uirevision, selectedpoints is controlled by layout.selectionrevision, and colorbar.(x|y) (accessible with config: {editable: true}) is controlled by layout.editrevision. Trace changes are tracked by uid, which only falls back on trace index if no uid is provided. So if your app can add/remove traces before the end of the data array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a uid that stays with it as it moves.
Sourcepub fn modify_all_ui_revision(value: impl Into<NumOrString>) -> RestylePie<P>
pub fn modify_all_ui_revision(value: impl Into<NumOrString>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_ui_revision(values: Vec<impl Into<NumOrString>>) -> RestylePie<P>
pub fn modify_ui_revision(values: Vec<impl Into<NumOrString>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn values(self, value: Vec<P>) -> Box<Self>
pub fn values(self, value: Vec<P>) -> Box<Self>
Sets the values of the sectors. If omitted, we count occurrences of each label.
Sourcepub fn modify_all_values(value: Vec<P>) -> RestylePie<P>
pub fn modify_all_values(value: Vec<P>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_values(values: Vec<Vec<P>>) -> RestylePie<P>
pub fn modify_values(values: Vec<Vec<P>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn visible(self, value: Visible) -> Box<Self>
pub fn visible(self, value: Visible) -> Box<Self>
Determines whether or not this trace is visible. If “legendonly”, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).
Sourcepub fn modify_all_visible(value: Visible) -> RestylePie<P>
pub fn modify_all_visible(value: Visible) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_visible(values: Vec<Visible>) -> RestylePie<P>
pub fn modify_visible(values: Vec<Visible>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn legend_width(self, value: f64) -> Box<Self>
pub fn legend_width(self, value: f64) -> Box<Self>
Sets the width (in px or fraction) of the legend for this trace.
Sourcepub fn modify_all_legend_width(value: f64) -> RestylePie<P>
pub fn modify_all_legend_width(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_legend_width(values: Vec<f64>) -> RestylePie<P>
pub fn modify_legend_width(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn pull(self, value: f64) -> Box<Self>
pub fn pull(self, value: f64) -> Box<Self>
Sets the fraction of larger radius to pull the sectors out from the center. This can be a constant to pull all slices apart from each other equally or an array to highlight one or more slices.
Sourcepub fn modify_all_pull(value: f64) -> RestylePie<P>
pub fn modify_all_pull(value: f64) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_pull(values: Vec<f64>) -> RestylePie<P>
pub fn modify_pull(values: Vec<f64>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn custom_data_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn custom_data_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for customdata.
Sourcepub fn modify_all_custom_data_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_custom_data_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_custom_data_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_custom_data_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn custom_data_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn custom_data_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for customdata.
Sourcepub fn hover_info_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn hover_info_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hoverinfo.
Sourcepub fn modify_all_hover_info_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_hover_info_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_info_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_hover_info_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_info_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn hover_info_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hoverinfo.
Sourcepub fn hover_template_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn hover_template_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hovertemplate.
Sourcepub fn modify_all_hover_template_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_hover_template_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_template_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_hover_template_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn hover_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hovertemplate.
Sourcepub fn hover_text_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn hover_text_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hovertext.
Sourcepub fn modify_all_hover_text_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_hover_text_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_hover_text_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_hover_text_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn hover_text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn hover_text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for hovertext.
Sourcepub fn idssrc(self, value: impl AsRef<str>) -> Box<Self>
pub fn idssrc(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for ids.
Sourcepub fn modify_all_idssrc(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_idssrc(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_idssrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_idssrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn idssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn idssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for ids.
Sourcepub fn labelssrc(self, value: impl AsRef<str>) -> Box<Self>
pub fn labelssrc(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for labels.
Sourcepub fn modify_all_labelssrc(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_labelssrc(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_labelssrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_labelssrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn labelssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn labelssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for labels.
Sourcepub fn metasrc(self, value: impl AsRef<str>) -> Box<Self>
pub fn metasrc(self, value: impl AsRef<str>) -> Box<Self>
metasrc – Sets the source reference on Chart Studio Cloud for meta.
Sourcepub fn modify_all_metasrc(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_metasrc(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_metasrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_metasrc(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn metasrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn metasrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
metasrc – Sets the source reference on Chart Studio Cloud for meta.
Sourcepub fn values_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn values_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for values.
Sourcepub fn modify_all_values_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_values_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_values_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_values_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn values_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn values_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for values.
Sourcepub fn pull_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn pull_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for pull.
Sourcepub fn modify_all_pull_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_pull_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_pull_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_pull_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn pull_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn pull_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for pull.
Sourcepub fn text_position_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn text_position_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for textposition.
Sourcepub fn modify_all_text_position_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text_position_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_position_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text_position_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_position_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn text_position_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for textposition.
Sourcepub fn text_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn text_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for text.
Sourcepub fn modify_all_text_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for text.
Sourcepub fn text_template_src(self, value: impl AsRef<str>) -> Box<Self>
pub fn text_template_src(self, value: impl AsRef<str>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for texttemplate.
Sourcepub fn modify_all_text_template_src(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_text_template_src(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_text_template_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_text_template_src(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn text_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
pub fn text_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>
Sets the source reference on Chart Studio Cloud for texttemplate.
Sourcepub fn uid(self, value: impl AsRef<str>) -> Box<Self>
pub fn uid(self, value: impl AsRef<str>) -> Box<Self>
Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
Sourcepub fn modify_all_uid(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_uid(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_uid(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_uid(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Sourcepub fn scale_group(self, value: impl AsRef<str>) -> Box<Self>
pub fn scale_group(self, value: impl AsRef<str>) -> Box<Self>
If there are multiple pie charts that should be sized according to their totals, link them by providing a non-empty group id here shared by every trace in the same group.
Sourcepub fn modify_all_scale_group(value: impl AsRef<str>) -> RestylePie<P>
pub fn modify_all_scale_group(value: impl AsRef<str>) -> RestylePie<P>
Apply the same restyling to all the traces
Sourcepub fn modify_scale_group(values: Vec<impl AsRef<str>>) -> RestylePie<P>
pub fn modify_scale_group(values: Vec<impl AsRef<str>>) -> RestylePie<P>
Apply the restyling individually to each trace. Caller is responsible to set the length of the vector to be equal to the number of traces
Source§impl<P> Pie<P>
impl<P> Pie<P>
Sourcepub fn new(values: Vec<P>) -> Box<Self>
pub fn new(values: Vec<P>) -> Box<Self>
Build a new Pie Chart by only assigning the values field
Sourcepub fn from_values(values: Vec<P>) -> Box<Self>
pub fn from_values(values: Vec<P>) -> Box<Self>
Same as Pie::new()
Sourcepub fn from_labels<T: AsRef<str> + ToString>(labels: &[T]) -> Box<Self>
pub fn from_labels<T: AsRef<str> + ToString>(labels: &[T]) -> Box<Self>
Build a new Pie Chart by only assigning the labels field. The Pie chart
will be generated by counting the number of unique labels, see
Pie::labels field description. Note that to create a Pie chart by
using this function, the type parameter P
needs to be specialized,
this can be done by doing
use plotly::Pie;
let labels = ["giraffes", "giraffes", "orangutans", "monkeys"];
let trace = Pie::<u32>::from_labels(&labels);