Struct Pie

Source
pub struct Pie<P>
where P: Serialize + Clone,
{ /* 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>
where P: Serialize + Clone,

Source

pub fn domain(self, value: Domain) -> Box<Self>

Source

pub fn modify_all_domain(value: Domain) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn automargin(self, value: bool) -> Box<Self>

Determines whether outside text labels can push the margins.

Source

pub fn modify_all_automargin(value: bool) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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

Source

pub fn modify_all_custom_data( value: Vec<impl Into<NumOrString> + Clone>, ) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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’]

Source

pub fn modify_all_direction(value: PieDirection) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn dlabel(self, value: f64) -> Box<Self>

Sets the label step. See label0 for more info.

Source

pub fn modify_all_dlabel(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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]

Source

pub fn modify_all_hole(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_hover_info(value: HoverInfo) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn hover_label(self, value: Label) -> Box<Self>

Source

pub fn modify_all_hover_label(value: Label) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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 “{fullData.name}”. To hide the secondary box completely, use an empty tag .

Source

pub fn modify_all_hover_template(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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 “{fullData.name}”. To hide the secondary box completely, use an empty tag .

Source

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.

Source

pub fn modify_all_hover_text(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

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.

Source

pub fn modify_all_ids(value: Vec<impl AsRef<str>>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn inside_text_font(self, value: Font) -> Box<Self>

Sets the font used for textinfo lying inside the sector.

Source

pub fn modify_all_inside_text_font(value: Font) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_inside_text_orientation(value: Orientation) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_label0(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_labels(value: Vec<impl AsRef<str>>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_legend_group(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn legend_group_title(self, value: impl Into<LegendGroupTitle>) -> Box<Self>

Set and style the title to appear for the legend group.

Source

pub fn modify_all_legend_group_title( value: impl Into<LegendGroupTitle>, ) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_legend_rank(value: usize) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn marker(self, value: Marker) -> Box<Self>

Source

pub fn modify_all_marker(value: Marker) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_meta(value: impl Into<NumOrString>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_name(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn opacity(self, value: f64) -> Box<Self>

Sets the opacity of the trace.

Source

pub fn modify_all_opacity(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn outside_text_font(self, value: Font) -> Box<Self>

Sets the font used for textinfo lying outside the sector.

Source

pub fn modify_all_outside_text_font(value: Font) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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).

Source

pub fn modify_all_rotation(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn show_legend(self, value: bool) -> Box<Self>

Determines whether or not an item corresponding to this trace is shown in the legend.

Source

pub fn modify_all_show_legend(value: bool) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn sort(self, value: bool) -> Box<Self>

Determines whether or not the sectors are reordered from largest to smallest.

Source

pub fn modify_all_sort(value: bool) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_text(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn text_info(self, value: impl AsRef<str>) -> Box<Self>

Determines which trace information appear on the graph.

Source

pub fn modify_all_text_info(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_font(self, value: Font) -> Box<Self>

Sets the font used for textinfo.

Source

pub fn modify_all_text_font(value: Font) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_position(self, value: Position) -> Box<Self>

Specifies the location of the textinfo.

Source

pub fn modify_all_text_position(value: Position) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_position_array(self, value: Vec<Position>) -> Box<Self>

Specifies the location of the textinfo.

Source

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.

Source

pub fn modify_all_text_template(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

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.

Source

pub fn modify_all_ui_revision(value: impl Into<NumOrString>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn values(self, value: Vec<P>) -> Box<Self>

Sets the values of the sectors. If omitted, we count occurrences of each label.

Source

pub fn modify_all_values(value: Vec<P>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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).

Source

pub fn modify_all_visible(value: Visible) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn legend_width(self, value: f64) -> Box<Self>

Sets the width (in px or fraction) of the legend for this trace.

Source

pub fn modify_all_legend_width(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_pull(value: f64) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn custom_data_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for customdata.

Source

pub fn modify_all_custom_data_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn custom_data_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for customdata.

Source

pub fn hover_info_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hoverinfo.

Source

pub fn modify_all_hover_info_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn hover_info_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hoverinfo.

Source

pub fn hover_template_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hovertemplate.

Source

pub fn modify_all_hover_template_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn hover_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hovertemplate.

Source

pub fn hover_text_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hovertext.

Source

pub fn modify_all_hover_text_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn hover_text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for hovertext.

Source

pub fn idssrc(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for ids.

Source

pub fn modify_all_idssrc(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn idssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for ids.

Source

pub fn labelssrc(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for labels.

Source

pub fn modify_all_labelssrc(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn labelssrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for labels.

Source

pub fn metasrc(self, value: impl AsRef<str>) -> Box<Self>

metasrc – Sets the source reference on Chart Studio Cloud for meta.

Source

pub fn modify_all_metasrc(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn metasrc_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

metasrc – Sets the source reference on Chart Studio Cloud for meta.

Source

pub fn values_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for values.

Source

pub fn modify_all_values_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn values_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for values.

Source

pub fn pull_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for pull.

Source

pub fn modify_all_pull_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn pull_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for pull.

Source

pub fn text_position_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for textposition.

Source

pub fn modify_all_text_position_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_position_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for textposition.

Source

pub fn text_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for text.

Source

pub fn modify_all_text_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for text.

Source

pub fn text_template_src(self, value: impl AsRef<str>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for texttemplate.

Source

pub fn modify_all_text_template_src(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

pub fn text_template_src_array(self, value: Vec<impl AsRef<str>>) -> Box<Self>

Sets the source reference on Chart Studio Cloud for texttemplate.

Source

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.

Source

pub fn modify_all_uid(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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

Source

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.

Source

pub fn modify_all_scale_group(value: impl AsRef<str>) -> RestylePie<P>

Apply the same restyling to all the traces

Source

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>
where P: Serialize + Clone + 'static,

Source

pub fn new(values: Vec<P>) -> Box<Self>

Build a new Pie Chart by only assigning the values field

Source

pub fn from_values(values: Vec<P>) -> Box<Self>

Same as Pie::new()

Source

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);

Trait Implementations§

Source§

impl<P> Clone for Pie<P>
where P: Serialize + Clone + Clone,

Source§

fn clone(&self) -> Pie<P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P> Debug for Pie<P>
where P: Serialize + Clone + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Default for Pie<P>
where P: Serialize + Clone,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<P> Serialize for Pie<P>
where P: Serialize + Clone + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<P> Trace for Pie<P>
where P: Serialize + Clone,

Source§

fn to_json(&self) -> String

Auto Trait Implementations§

§

impl<P> Freeze for Pie<P>

§

impl<P> !RefUnwindSafe for Pie<P>

§

impl<P> Send for Pie<P>
where P: Send,

§

impl<P> Sync for Pie<P>
where P: Sync,

§

impl<P> Unpin for Pie<P>
where P: Unpin,

§

impl<P> !UnwindSafe for Pie<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V