-
-A plotting library for Rust powered by [Plotly.js](https://plot.ly/javascript/).
-
-
-## Usage
-
-Add this to your `Cargo.toml`:
-
-```toml
-[dependencies]
-plotly = "0.8.1"
-```
-
-For changes since the last version please consult the [change log](https://github.com/igiagkiozis/plotly/blob/master/CHANGELOG.md).
-
-## Crate Feature Flags
-The following feature flags are available:
-* `kaleido`
- * Optional, compatible with Rust stable.
- * Adds plot save functionality to the following formats: png, jpeg, webp, svg, pdf and eps.
- * Requires some additional configuration, see [plotly_kaleido](https://github.com/igiagkiozis/plotly/tree/master/plotly_kaleido).
-* `plotly_ndarray`
- * Optional, compatible with Rust stable.
- * Adds support for creating plots directly using [ndarray](https://github.com/rust-ndarray/ndarray) types.
-* `wasm`
- * Optional, compatible with Rust stable.
- * Adds support for building with wasm-unknown-unknown target triple, enabling use within web development.
-
-Saving to png, jpeg, webp, svg, pdf and eps formats can be made available by enabling the `kaleido` feature:
-
-```toml
-[dependencies]
-plotly = { version = "0.8.1", features = ["kaleido"] }
-```
-For further details please see [plotly_kaleido](https://github.com/igiagkiozis/plotly/tree/master/plotly_kaleido).
-
-
-# Contributing
-
-Please consult the [contributing guide](https://github.com/igiagkiozis/plotly/blob/master/CONTRIBUTING.md).
-
-# License
-
-Plotly.rs is distributed under the terms of the MIT license.
-
-See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/master/COPYRIGHT) for details.
+See the [project root](https://github.com/igiagkiozis/plotly) for the Plotly.rs REAEDME.
\ No newline at end of file
diff --git a/plotly/examples/jupyter_lab_examples.ipynb b/plotly/examples/jupyter_lab_examples.ipynb
deleted file mode 100644
index b4df6af5..00000000
--- a/plotly/examples/jupyter_lab_examples.ipynb
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- ":dep plotly = { version = \">=0.7.0\" }\n",
- ":dep itertools-num = \"0.1.3\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "extern crate plotly;\n",
- "extern crate rand_distr;\n",
- "extern crate itertools_num;\n",
- "extern crate itertools;"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "use itertools_num::linspace;\n",
- "use plotly::common::{\n",
- " ColorScale, ColorScalePalette, DashType, Fill, Font, Line, LineShape, Marker, Mode, Title,\n",
- "};\n",
- "use plotly::layout::{Axis, BarMode, Layout, Legend, TicksDirection};\n",
- "use plotly::{Bar, NamedColor, Plot, Rgb, Rgba, Scatter};\n",
- "use rand_distr::{Distribution, Normal, Uniform};"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "fn simple_scatter_plot(show: bool) {\n",
- " let n: usize = 100;\n",
- " let t: Vec = linspace(0., 10., n).collect();\n",
- " let y: Vec = t.iter().map(|x| x.sin()).collect();\n",
- "\n",
- " let trace = Scatter::new(t, y).mode(Mode::Markers);\n",
- " let mut plot = Plot::new();\n",
- " plot.add_trace(trace);\n",
- " let layout = Layout::new().height(800);\n",
- " plot.set_layout(layout);\n",
- " plot.lab_display();\n",
- "}"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "simple_scatter_plot(true)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Rust",
- "language": "rust",
- "name": "rust"
- },
- "language_info": {
- "codemirror_mode": "rust",
- "file_extension": ".rs",
- "mimetype": "text/rust",
- "name": "Rust",
- "pygment_lexer": "rust",
- "version": ""
- }
- },
- "nbformat": 4,
- "nbformat_minor": 4
-}
diff --git a/plotly/examples/jupyter_notebook_examples.ipynb b/plotly/examples/jupyter_notebook_examples.ipynb
deleted file mode 100644
index 228a5a54..00000000
--- a/plotly/examples/jupyter_notebook_examples.ipynb
+++ /dev/null
@@ -1,130 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- ":dep plotly = { version = \">=0.7.0\" }\n",
- ":dep itertools-num = \"0.1.3\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [],
- "source": [
- "extern crate plotly;\n",
- "extern crate rand_distr;\n",
- "extern crate itertools_num;\n",
- "extern crate itertools;"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "scrolled": true
- },
- "outputs": [],
- "source": [
- "use itertools_num::linspace;\n",
- "use plotly::common::{\n",
- " ColorScale, ColorScalePalette, DashType, Fill, Font, Line, LineShape, Marker, Mode, Title,\n",
- "};\n",
- "use plotly::layout::{Axis, BarMode, Layout, Legend, TicksDirection};\n",
- "use plotly::{Bar, NamedColor, Plot, Rgb, Rgba, Scatter};\n",
- "use rand_distr::{Distribution, Normal, Uniform};"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 9,
- "metadata": {
- "scrolled": true
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- " \n",
- " \n",
- "
"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "let n: usize = 100;\n",
- "let t = vec![1,2,3,4,5,6,7,8,9,10];\n",
- "let y = t.iter().map(|v| (*v as f64).powf(2.0)).collect::>();\n",
- "let trace = Scatter::new(t,y).mode(Mode::Markers);\n",
- "let mut plot = Plot::new();\n",
- "plot.add_trace(trace);\n",
- "let layout = Layout::new().height(525);\n",
- "plot.set_layout(layout);\n",
- "plot.notebook_display();"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Rust",
- "language": "rust",
- "name": "rust"
- },
- "language_info": {
- "codemirror_mode": "rust",
- "file_extension": ".rs",
- "mimetype": "text/rust",
- "name": "Rust",
- "pygment_lexer": "rust",
- "version": ""
- }
- },
- "nbformat": 4,
- "nbformat_minor": 4
-}
diff --git a/plotly/src/bindings.rs b/plotly/src/bindings.rs
index 8595308c..ecb3f43e 100644
--- a/plotly/src/bindings.rs
+++ b/plotly/src/bindings.rs
@@ -1,5 +1,6 @@
-//! Bindings to the underlying plotly.js Javascript API. To be used in a WASM context, where it is assumed that a
-//! remote copy of the Javascript Plotly library is available, (i.e. via a CDN).
+//! Bindings to the underlying plotly.js Javascript API. To be used in a WASM
+//! context, where it is assumed that a remote copy of the Javascript Plotly
+//! library is available, (i.e. via a CDN).
use js_sys::Object;
use wasm_bindgen::prelude::*;
@@ -18,14 +19,15 @@ extern "C" {
/// A wrapper around the plotly.js [newPlot](https://plotly.com/javascript/plotlyjs-function-reference/#plotlynewplot)
/// function.
///
-/// The function signature is slightly constrained in that `id` is a `&str` which represents
-/// the `id` of an existing HTML `div` element, rather than also allowing an instance of a `div`
-/// element, itself.
+/// The function signature is slightly constrained in that `id` is a `&str`
+/// which represents the `id` of an existing HTML `div` element, rather than
+/// also allowing an instance of a `div` element, itself.
pub async fn new_plot(id: &str, plot: &Plot) {
let plot_obj = &plot.to_js_object();
- // This will only fail if the Rust Plotly library has produced plotly-incompatible JSON. An error here
- // should have been handled by the library, rather than down here.
+ // This will only fail if the Rust Plotly library has produced
+ // plotly-incompatible JSON. An error here should have been handled by the
+ // library, rather than down here.
new_plot_(id, &plot_obj)
.await
.expect("Error plotting chart");
@@ -34,13 +36,14 @@ pub async fn new_plot(id: &str, plot: &Plot) {
/// A wrapper around the plotly.js [react](https://plotly.com/javascript/plotlyjs-function-reference/#react)
/// function.
///
-/// The function signature is slightly constrained in that `id` is a `&str` which represents
-/// the `id` of an existing HTML `div` element, rather than also allowing an instance of a `div`
-/// element, itself.
+/// The function signature is slightly constrained in that `id` is a `&str`
+/// which represents the `id` of an existing HTML `div` element, rather than
+/// also allowing an instance of a `div` element, itself.
pub async fn react(id: &str, plot: &Plot) {
let plot_obj = &plot.to_js_object();
- // This will only fail if the Rust Plotly library has produced plotly-incompatible JSON. An error here
- // should have been handled by the library, rather than down here.
+ // This will only fail if the Rust Plotly library has produced
+ // plotly-incompatible JSON. An error here should have been handled by the
+ // library, rather than down here.
react_(id, &plot_obj).await.expect("Error plotting chart");
}
diff --git a/plotly/src/common/color.rs b/plotly/src/common/color.rs
index ba867270..06121ef8 100644
--- a/plotly/src/common/color.rs
+++ b/plotly/src/common/color.rs
@@ -1,15 +1,19 @@
-//! This module provides several user interfaces for describing a color to be used throughout the rest of the library.
-//! The easiest way of describing a colour is to use a `&str` or `String`, which is simply serialized as-is and
-//! passed on to the underlying `plotly.js` library. `plotly.js` supports [`CSS color formats`], and will fallback
-//! to some default color if the color string is malformed.
+//! This module provides several user interfaces for describing a color to be
+//! used throughout the rest of the library. The easiest way of describing a
+//! colour is to use a `&str` or `String`, which is simply serialized as-is and
+//! passed on to the underlying `plotly.js` library. `plotly.js` supports [`CSS
+//! color formats`], and will fallback to some default color if the color string
+//! is malformed.
//!
-//! For a more type-safe approach, the `RGB` or `RGBA` structs can be used to construct a valid color, which will then
-//! get serialized to an appropriate string representation. Cross-browser compatible [`predefined colors`] are
+//! For a more type-safe approach, the `RGB` or `RGBA` structs can be used to
+//! construct a valid color, which will then get serialized to an appropriate
+//! string representation. Cross-browser compatible [`predefined colors`] are
//! supported via the `NamedColor` enum.
//!
-//! The `Color` trait is public, and so can be implemented for custom colour types. The user can then implement
-//! a valid serialization function according to their own requirements. On the whole, that should be largely
-//! unnecessary given the functionality already provided within this module.
+//! The `Color` trait is public, and so can be implemented for custom colour
+//! types. The user can then implement a valid serialization function according
+//! to their own requirements. On the whole, that should be largely unnecessary
+//! given the functionality already provided within this module.
//!
//! [`CSS color formats`]: https://www.w3schools.com/cssref/css_colors_legal.asp
//! [`predefined colors`]: https://www.w3schools.com/cssref/css_colors.asp
@@ -30,8 +34,9 @@ impl Color for String {}
impl Color for Rgb {}
impl Color for Rgba {}
-/// ColorArray is only used internally to provide a helper method for converting Vec to
-/// Vec>, as we would otherwise fall foul of the orphan rules.
+/// ColorArray is only used internally to provide a helper method for converting
+/// Vec to Vec>, as we would otherwise fall foul of
+/// the orphan rules.
pub(crate) struct ColorArray(pub(crate) Vec);
#[allow(clippy::from_over_into)]
@@ -44,12 +49,13 @@ impl Into>> for ColorArray {
}
}
-/// A type-safe way of constructing a valid RGB color from constituent R, G and B channels.
+/// A type-safe way of constructing a valid RGB color from constituent R, G and
+/// B channels.
#[derive(Debug, Clone, Copy)]
pub struct Rgb {
- r: u8,
- g: u8,
- b: u8,
+ pub(crate) r: u8,
+ pub(crate) g: u8,
+ pub(crate) b: u8,
}
impl Rgb {
@@ -68,13 +74,14 @@ impl Serialize for Rgb {
}
}
-/// A type-safe way of constructing a valid RGBA color from constituent R, G, B and A channels.
+/// A type-safe way of constructing a valid RGBA color from constituent R, G, B
+/// and A channels.
#[derive(Debug, Clone, Copy)]
pub struct Rgba {
- r: u8,
- g: u8,
- b: u8,
- a: f64,
+ pub(crate) r: u8,
+ pub(crate) g: u8,
+ pub(crate) b: u8,
+ pub(crate) a: f64,
}
impl Rgba {
diff --git a/plotly/src/common/mod.rs b/plotly/src/common/mod.rs
index 2aa5bea2..1b2a4257 100644
--- a/plotly/src/common/mod.rs
+++ b/plotly/src/common/mod.rs
@@ -186,6 +186,7 @@ pub enum PlotType {
Scatter,
ScatterGL,
Scatter3D,
+ ScatterMapbox,
ScatterPolar,
ScatterPolarGL,
Bar,
@@ -195,6 +196,8 @@ pub enum PlotType {
HeatMap,
Histogram,
Histogram2dContour,
+ Image,
+ Mesh3D,
Ohlc,
Sankey,
Surface,
@@ -1487,7 +1490,8 @@ mod tests {
#[test]
fn test_serialize_direction() {
- // TODO: I think `Direction` would be better as a struct, with `fillcolor` and `line` attributes
+ // TODO: I think `Direction` would be better as a struct, with `fillcolor` and
+ // `line` attributes
let inc = Direction::Increasing { line: Line::new() };
let expected = json!({"line": {}});
assert_eq!(to_value(inc).unwrap(), expected);
diff --git a/plotly/src/configuration.rs b/plotly/src/configuration.rs
index 539c5a12..95043caf 100644
--- a/plotly/src/configuration.rs
+++ b/plotly/src/configuration.rs
@@ -51,8 +51,8 @@ impl ToImageButtonOptions {
self
}
- /// Set the scale of the downloaded plot image. Title, legend, axis and canvas sizes
- /// will all be multiplied by `scale`.
+ /// Set the scale of the downloaded plot image. Title, legend, axis and
+ /// canvas sizes will all be multiplied by `scale`.
pub fn scale(mut self, scale: usize) -> Self {
self.scale = Some(scale);
self
@@ -189,91 +189,99 @@ pub struct Configuration {
}
impl Configuration {
- /// Create a new default `Configuration` object. Options can be configured using the
- /// provided setter methods.
+ /// Create a new default `Configuration` object. Options can be configured
+ /// using the provided setter methods.
pub fn new() -> Self {
Default::default()
}
- /// Determines whether the graphs are interactive or not. If `false`, no interactivity,
- /// for export or image generation.
+ /// Determines whether the graphs are interactive or not. If `false`, no
+ /// interactivity, for export or image generation.
pub fn static_plot(mut self, static_plot: bool) -> Self {
self.static_plot = Some(static_plot);
self
}
- /// Determines whether math should be typeset or not, when MathJax (either v2 or v3) is present on the page.
+ /// Determines whether math should be typeset or not, when MathJax (either
+ /// v2 or v3) is present on the page.
pub fn typeset_math(mut self, typeset_math: bool) -> Self {
self.typeset_math = Some(typeset_math);
self
}
- /// When set it determines base URL for the "Edit in Chart Studio" `show_edit_in_chart_studio`/`show_send_to_cloud`
- /// mode bar button and the show_link/send_data on-graph link. To enable sending your data to Chart Studio
- /// Cloud, you need to set both `plotly_server_url` to "https://chart-studio.plotly.com" and
+ /// When set it determines base URL for the "Edit in Chart Studio"
+ /// `show_edit_in_chart_studio`/`show_send_to_cloud` mode bar button and
+ /// the show_link/send_data on-graph link. To enable sending your data to
+ /// Chart Studio Cloud, you need to set both `plotly_server_url` to "https://chart-studio.plotly.com" and
/// also set `showSendToCloud` to `true`.
pub fn plotly_server_url(mut self, plotly_server_url: &str) -> Self {
self.plotly_server_url = Some(plotly_server_url.to_string());
self
}
- /// Determines whether the graph is editable or not. Sets all pieces of `edits` unless a separate
- /// `edits` config item overrides individual parts.
+ /// Determines whether the graph is editable or not. Sets all pieces of
+ /// `edits` unless a separate `edits` config item overrides individual
+ /// parts.
pub fn editable(mut self, editable: bool) -> Self {
self.editable = Some(editable);
self
}
- /// Determines whether the graphs are plotted with respect to layout.auto_size: true and infer
- /// its container size.
+ /// Determines whether the graphs are plotted with respect to
+ /// layout.auto_size: true and infer its container size.
pub fn autosizable(mut self, autosizable: bool) -> Self {
self.autosizable = Some(autosizable);
self
}
- /// Determines whether to change the layout size when window is resized. In v3, this option will be
- /// removed and will always be true.
+ /// Determines whether to change the layout size when window is resized. In
+ /// v3, this option will be removed and will always be true.
pub fn responsive(mut self, responsive: bool) -> Self {
self.responsive = Some(responsive);
self
}
- /// When `layout.auto_size` is turned on, determines whether the graph fills the container
- /// (the default) or the screen (if set to `true`).
+ /// When `layout.auto_size` is turned on, determines whether the graph fills
+ /// the container (the default) or the screen (if set to `true`).
pub fn fill_frame(mut self, fill_frame: bool) -> Self {
self.fill_frame = Some(fill_frame);
self
}
- /// When `layout.auto_size` is turned on, set the frame margins in fraction of the graph size.
+ /// When `layout.auto_size` is turned on, set the frame margins in fraction
+ /// of the graph size.
pub fn frame_margins(mut self, frame_margins: f64) -> Self {
// TODO: plotly supports a minimum value of 0 and a maximum value of 0.5
self.frame_margins = Some(frame_margins);
self
}
- /// Determines whether mouse wheel or two-finger scroll zooms is enable. Turned on by default for
- /// gl3d, geo and mapbox subplots (as these subplot types do not have zoombox via pan), but
- /// turned off by default for cartesian subplots. Set `scroll_zoom` to `false` to disable scrolling for
- /// all subplots.
+ /// Determines whether mouse wheel or two-finger scroll zooms is enable.
+ /// Turned on by default for gl3d, geo and mapbox subplots (as these
+ /// subplot types do not have zoombox via pan), but turned off by
+ /// default for cartesian subplots. Set `scroll_zoom` to `false` to disable
+ /// scrolling for all subplots.
pub fn scroll_zoom(mut self, scroll_zoom: bool) -> Self {
self.scroll_zoom = Some(scroll_zoom);
self
}
- /// Sets the double click interaction mode. Has an effect only in cartesian plots. If `false`,
- /// double click is disable. If `reset`, double click resets the axis ranges to their initial values.
- /// If `autosize`, double click set the axis ranges to their autorange values. If `reset+autosize`,
- /// the odd double clicks resets the axis ranges to their initial values and even double clicks set
- /// the axis ranges to their autorange values.
+ /// Sets the double click interaction mode. Has an effect only in cartesian
+ /// plots. If `false`, double click is disable. If `reset`, double click
+ /// resets the axis ranges to their initial values. If `autosize`,
+ /// double click set the axis ranges to their autorange values. If
+ /// `reset+autosize`, the odd double clicks resets the axis ranges to
+ /// their initial values and even double clicks set the axis ranges to
+ /// their autorange values.
pub fn double_click(mut self, double_click: DoubleClick) -> Self {
self.double_click = Some(double_click);
self
}
- /// Sets the delay for registering a double-click in ms. This is the time interval (in ms) between
- /// first mousedown and 2nd mouseup to constitute a double-click. This setting propagates to all
- /// on-subplot double clicks (except for geo and mapbox) and on-legend double clicks.
+ /// Sets the delay for registering a double-click in ms. This is the time
+ /// interval (in ms) between first mousedown and 2nd mouseup to
+ /// constitute a double-click. This setting propagates to all on-subplot
+ /// double clicks (except for geo and mapbox) and on-legend double clicks.
pub fn double_click_delay(mut self, double_click_delay: usize) -> Self {
self.double_click_delay = Some(double_click_delay);
self
@@ -285,21 +293,24 @@ impl Configuration {
self
}
- /// Set to `false` to omit direct range entry at the pan/zoom drag points, note that `show_axis_drag_handles`
- /// must be enabled to have an effect.
+ /// Set to `false` to omit direct range entry at the pan/zoom drag points,
+ /// note that `show_axis_drag_handles` must be enabled to have an
+ /// effect.
pub fn show_axis_range_entry_boxes(mut self, show_axis_range_entry_boxes: bool) -> Self {
self.show_axis_range_entry_boxes = Some(show_axis_range_entry_boxes);
self
}
- /// Determines whether or not tips are shown while interacting with the resulting graphs.
+ /// Determines whether or not tips are shown while interacting with the
+ /// resulting graphs.
pub fn show_tips(mut self, show_tips: bool) -> Self {
self.show_tips = Some(show_tips);
self
}
- /// Determines whether a link to Chart Studio Cloud is displayed at the bottom right corner of resulting
- /// graphs. Use with `send_data` and `link_text`.
+ /// Determines whether a link to Chart Studio Cloud is displayed at the
+ /// bottom right corner of resulting graphs. Use with `send_data` and
+ /// `link_text`.
pub fn show_link(mut self, show_link: bool) -> Self {
self.show_link = Some(show_link);
self
@@ -311,34 +322,40 @@ impl Configuration {
self
}
- /// If `show_link` is true, does it contain data just link to a Chart Studio Cloud file?
+ /// If `show_link` is true, does it contain data just link to a Chart Studio
+ /// Cloud file?
pub fn send_data(mut self, send_data: bool) -> Self {
self.send_data = Some(send_data);
self
}
- /// Determines the mode bar display mode. If `true`, the mode bar is always visible. If `false`,
- /// the mode bar is always hidden. If `hover`, the mode bar is visible while the mouse cursor
- /// is on the graph container.
+ /// Determines the mode bar display mode. If `true`, the mode bar is always
+ /// visible. If `false`, the mode bar is always hidden. If `hover`, the
+ /// mode bar is visible while the mouse cursor is on the graph
+ /// container.
pub fn display_mode_bar(mut self, display_mode_bar: DisplayModeBar) -> Self {
self.display_mode_bar = Some(display_mode_bar);
self
}
- /// Should we include a ModeBar button, labeled "Edit in Chart Studio" that sends this chart to
- /// chart-studio.plotly.com (formerly plot.ly) or another plotly server as specified by `plotly_server_url`
- /// for editing, export, etc? Prior to version 1.43.0 this button was included by default, now it is
- /// opt-in using this flag. Note that this button can (depending on `plotly_server_url` being set) send your
- /// data to an external server. However that server does not persist your data until you arrive at the Chart
- /// Studio and explicitly click "Save".
+ /// Should we include a ModeBar button, labeled "Edit in Chart Studio" that
+ /// sends this chart to chart-studio.plotly.com (formerly plot.ly) or
+ /// another plotly server as specified by `plotly_server_url`
+ /// for editing, export, etc? Prior to version 1.43.0 this button was
+ /// included by default, now it is opt-in using this flag. Note that
+ /// this button can (depending on `plotly_server_url` being set) send your
+ /// data to an external server. However that server does not persist your
+ /// data until you arrive at the Chart Studio and explicitly click
+ /// "Save".
pub fn show_send_to_cloud(mut self, show_send_to_cloud: bool) -> Self {
self.show_send_to_cloud = Some(show_send_to_cloud);
self
}
- /// Same as `show_send_to_cloud`, but use a pencil icon instead of a floppy-disk. Note that if both
- /// `show_send_to_cloud` and `show_edit_in_chart_studio` are turned on, only `show_edit_in_chart_studio` will
- /// be honored.
+ /// Same as `show_send_to_cloud`, but use a pencil icon instead of a
+ /// floppy-disk. Note that if both `show_send_to_cloud` and
+ /// `show_edit_in_chart_studio` are turned on, only
+ /// `show_edit_in_chart_studio` will be honored.
pub fn show_edit_in_chart_studio(mut self, show_edit_in_chart_studio: bool) -> Self {
self.show_edit_in_chart_studio = Some(show_edit_in_chart_studio);
self
@@ -362,7 +379,8 @@ impl Configuration {
self
}
- /// Determines whether or not the plotly logo is displayed on the end of the mode bar.
+ /// Determines whether or not the plotly logo is displayed on the end of the
+ /// mode bar.
pub fn display_logo(mut self, display_logo: bool) -> Self {
self.display_logo = Some(display_logo);
self
@@ -380,16 +398,18 @@ impl Configuration {
self
}
- /// Set the URL to topojson used in geo charts. By default, the topojson files are fetched from
- /// cdn.plot.ly. For example, set this option to: "/dist/topojson/" to render
- /// geographical feature using the topojson files that ship with the plotly.js module.
+ /// Set the URL to topojson used in geo charts. By default, the topojson
+ /// files are fetched from cdn.plot.ly. For example, set this option to:
+ /// "/dist/topojson/" to render geographical feature
+ /// using the topojson files that ship with the plotly.js module.
pub fn topojson_url(mut self, topojson_url: &str) -> Self {
self.topojson_url = Some(topojson_url.to_string());
self
}
- /// Mapbox access token (required to plot mapbox trace types). If using an Mapbox Atlas server, set
- /// this option to "" so that plotly.js won't attempt to authenticate to the public Mapbox server.
+ /// Mapbox access token (required to plot mapbox trace types). If using an
+ /// Mapbox Atlas server, set this option to "" so that plotly.js won't
+ /// attempt to authenticate to the public Mapbox server.
pub fn mapbox_access_token(mut self, mapbox_access_token: &str) -> Self {
self.mapbox_access_token = Some(mapbox_access_token.to_string());
self
@@ -401,9 +421,9 @@ impl Configuration {
self
}
- /// Sets which localization to use. When using this setting, make sure that the appropriate locale is
- /// present in the HTML file. For example, to use the "fr" locale,
- /// must be present.
+ /// Sets which localization to use. When using this setting, make sure that
+ /// the appropriate locale is present in the HTML file. For example, to
+ /// use the "fr" locale, must be present.
pub fn locale(mut self, locale: &str) -> Self {
self.locale = Some(locale.to_string());
self
diff --git a/plotly/src/layout/mod.rs b/plotly/src/layout/mod.rs
index a1af744b..2f77871b 100644
--- a/plotly/src/layout/mod.rs
+++ b/plotly/src/layout/mod.rs
@@ -5,6 +5,7 @@ use std::borrow::Cow;
use plotly_derive::FieldSetter;
use serde::{Serialize, Serializer};
+use update_menu::UpdateMenu;
use crate::{
color::Color,
@@ -14,7 +15,6 @@ use crate::{
},
private::{NumOrString, NumOrStringCollection},
};
-use update_menu::UpdateMenu;
#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "lowercase")]
@@ -755,8 +755,9 @@ pub struct ShapeLine {
color: Option>,
/// Sets the line width (in px).
width: Option,
- /// Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash",
- /// "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px").
+ /// Sets the dash style of lines. Set to a dash type string ("solid", "dot",
+ /// "dash", "longdash", "dashdot", or "longdashdot") or a dash length
+ /// list in px (eg "5px,10px,2px,2px").
dash: Option,
}
@@ -775,95 +776,116 @@ pub struct Shape {
r#type: Option,
/// Specifies whether shapes are drawn below or above traces.
layer: Option,
- /// Sets the shape's x coordinate axis. If set to an x axis id (e.g. "x" or "x2"), the `x`
- /// position refers to an x coordinate. If set to "paper", the `x` position refers to the
- /// distance from the left side of the plotting area in normalized coordinates where "0" ("1")
- /// corresponds to the left (right) side. If the axis `type` is "log", then you must take the
- /// log of your desired range. If the axis `type` is "date", then you must convert the date to
- /// unix time in milliseconds.
+ /// Sets the shape's x coordinate axis. If set to an x axis id (e.g. "x" or
+ /// "x2"), the `x` position refers to an x coordinate. If set to
+ /// "paper", the `x` position refers to the distance from the left side
+ /// of the plotting area in normalized coordinates where "0" ("1")
+ /// corresponds to the left (right) side. If the axis `type` is "log", then
+ /// you must take the log of your desired range. If the axis `type` is
+ /// "date", then you must convert the date to unix time in milliseconds.
#[serde(rename = "xref")]
x_ref: Option,
- /// Sets the shapes's sizing mode along the x axis. If set to "scaled", `x0`, `x1` and x
- /// coordinates within `path` refer to data values on the x axis or a fraction of the plot
- /// area's width (`xref` set to "paper"). If set to "pixel", `xanchor` specifies the x position
- /// in terms of data or plot fraction but `x0`, `x1` and x coordinates within `path` are pixels
- /// relative to `xanchor`. This way, the shape can have a fixed width while maintaining a
- /// position relative to data or plot fraction.
+ /// Sets the shapes's sizing mode along the x axis. If set to "scaled",
+ /// `x0`, `x1` and x coordinates within `path` refer to data values on
+ /// the x axis or a fraction of the plot area's width (`xref` set to
+ /// "paper"). If set to "pixel", `xanchor` specifies the x position
+ /// in terms of data or plot fraction but `x0`, `x1` and x coordinates
+ /// within `path` are pixels relative to `xanchor`. This way, the shape
+ /// can have a fixed width while maintaining a position relative to data
+ /// or plot fraction.
#[serde(rename = "xsizemode")]
x_size_mode: Option,
- /// Only relevant in conjunction with `xsizemode` set to "pixel". Specifies the anchor point on
- /// the x axis to which `x0`, `x1` and x coordinates within `path` are relative to. E.g. useful
- /// to attach a pixel sized shape to a certain data value. No effect when `xsizemode` not set
- /// to "pixel".
+ /// Only relevant in conjunction with `xsizemode` set to "pixel". Specifies
+ /// the anchor point on the x axis to which `x0`, `x1` and x coordinates
+ /// within `path` are relative to. E.g. useful to attach a pixel sized
+ /// shape to a certain data value. No effect when `xsizemode` not set to
+ /// "pixel".
#[serde(rename = "xanchor")]
x_anchor: Option,
- /// Sets the shape's starting x position. See `type` and `xsizemode` for more info.
+ /// Sets the shape's starting x position. See `type` and `xsizemode` for
+ /// more info.
x0: Option,
- /// Sets the shape's end x position. See `type` and `xsizemode` for more info.
+ /// Sets the shape's end x position. See `type` and `xsizemode` for more
+ /// info.
x1: Option,
- /// Sets the annotation's y coordinate axis. If set to an y axis id (e.g. "y" or "y2"),
- /// the `y` position refers to an y coordinate If set to "paper", the `y` position refers to
- /// the distance from the bottom of the plotting area in normalized coordinates where "0" ("1")
+ /// Sets the annotation's y coordinate axis. If set to an y axis id (e.g.
+ /// "y" or "y2"), the `y` position refers to an y coordinate If set to
+ /// "paper", the `y` position refers to the distance from the bottom of
+ /// the plotting area in normalized coordinates where "0" ("1")
/// corresponds to the bottom (top).
#[serde(rename = "yref")]
y_ref: Option,
- /// Sets the shapes's sizing mode along the y axis. If set to "scaled", `y0`, `y1` and y
- /// coordinates within `path` refer to data values on the y axis or a fraction of the plot
- /// area's height (`yref` set to "paper"). If set to "pixel", `yanchor` specifies the y position
- /// in terms of data or plot fraction but `y0`, `y1` and y coordinates within `path` are pixels
- /// relative to `yanchor`. This way, the shape can have a fixed height while maintaining a
- /// position relative to data or plot fraction.
+ /// Sets the shapes's sizing mode along the y axis. If set to "scaled",
+ /// `y0`, `y1` and y coordinates within `path` refer to data values on
+ /// the y axis or a fraction of the plot area's height (`yref` set to
+ /// "paper"). If set to "pixel", `yanchor` specifies the y position
+ /// in terms of data or plot fraction but `y0`, `y1` and y coordinates
+ /// within `path` are pixels relative to `yanchor`. This way, the shape
+ /// can have a fixed height while maintaining a position relative to
+ /// data or plot fraction.
#[serde(rename = "ysizemode")]
y_size_mode: Option,
- /// Only relevant in conjunction with `ysizemode` set to "pixel". Specifies the anchor point on
- /// the y axis to which `y0`, `y1` and y coordinates within `path` are relative to. E.g. useful
- /// to attach a pixel sized shape to a certain data value. No effect when `ysizemode` not set
- /// to "pixel".
+ /// Only relevant in conjunction with `ysizemode` set to "pixel". Specifies
+ /// the anchor point on the y axis to which `y0`, `y1` and y coordinates
+ /// within `path` are relative to. E.g. useful to attach a pixel sized
+ /// shape to a certain data value. No effect when `ysizemode` not set to
+ /// "pixel".
#[serde(rename = "yanchor")]
y_anchor: Option,
- /// Sets the shape's starting y position. See `type` and `ysizemode` for more info.
+ /// Sets the shape's starting y position. See `type` and `ysizemode` for
+ /// more info.
y0: Option,
- /// Sets the shape's end y position. See `type` and `ysizemode` for more info.
+ /// Sets the shape's end y position. See `type` and `ysizemode` for more
+ /// info.
y1: Option,
- /// For `type` "path" - a valid SVG path with the pixel values replaced by data values in
- /// `xsizemode`/`ysizemode` being "scaled" and taken unmodified as pixels relative to
- /// `xanchor` and `yanchor` in case of "pixel" size mode. There are a few restrictions / quirks
+ /// For `type` "path" - a valid SVG path with the pixel values replaced by
+ /// data values in `xsizemode`/`ysizemode` being "scaled" and taken
+ /// unmodified as pixels relative to `xanchor` and `yanchor` in case of
+ /// "pixel" size mode. There are a few restrictions / quirks
/// only absolute instructions, not relative. So the allowed segments
- /// are: M, L, H, V, Q, C, T, S, and Z arcs (A) are not allowed because radius rx and ry are
- /// relative. In the future we could consider supporting relative commands, but we would have
- /// to decide on how to handle date and log axes. Note that even as is, Q and C Bezier paths
- /// that are smooth on linear axes may not be smooth on log, and vice versa. no chained
- /// "polybezier" commands - specify the segment type for each one. On category axes, values are
- /// numbers scaled to the serial numbers of categories because using the categories themselves
- /// there would be no way to describe fractional positions On data axes: because space and T are
- /// both normal components of path strings, we can't use either to separate date from time parts.
- /// Therefore we'll use underscore for this purpose: 2015-02-21_13:45:56.789
+ /// are: M, L, H, V, Q, C, T, S, and Z arcs (A) are not allowed because
+ /// radius rx and ry are relative. In the future we could consider
+ /// supporting relative commands, but we would have to decide on how to
+ /// handle date and log axes. Note that even as is, Q and C Bezier paths
+ /// that are smooth on linear axes may not be smooth on log, and vice versa.
+ /// no chained "polybezier" commands - specify the segment type for each
+ /// one. On category axes, values are numbers scaled to the serial
+ /// numbers of categories because using the categories themselves
+ /// there would be no way to describe fractional positions On data axes:
+ /// because space and T are both normal components of path strings, we
+ /// can't use either to separate date from time parts. Therefore we'll
+ /// use underscore for this purpose: 2015-02-21_13:45:56.789
path: Option,
/// Sets the opacity of the shape. Number between or equal to 0 and 1.
opacity: Option,
/// Sets the shape line properties (`color`, `width`, `dash`).
line: Option,
- /// Sets the color filling the shape's interior. Only applies to closed shapes.
+ /// Sets the color filling the shape's interior. Only applies to closed
+ /// shapes.
#[serde(rename = "fillcolor")]
fill_color: Option>,
- /// Determines which regions of complex paths constitute the interior. For more info please
- /// visit https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule
+ /// Determines which regions of complex paths constitute the interior. For
+ /// more info please visit https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule
#[serde(rename = "fillrule")]
fill_rule: Option,
- /// Determines whether the shape could be activated for edit or not. Has no effect when the
- /// older editable shapes mode is enabled via `config.editable` or `config.edits.shapePosition`.
+ /// Determines whether the shape could be activated for edit or not. Has no
+ /// effect when the older editable shapes mode is enabled via
+ /// `config.editable` or `config.edits.shapePosition`.
editable: Option,
- /// When used in a template, named items are created in the output figure in addition to any
- /// items the figure already has in this array. You can modify these items in the output figure
- /// by making your own item with `templateitemname` matching this `name` alongside your
- /// modifications (including `visible: false` or `enabled: false` to hide it). Has no effect
- /// outside of a template.
+ /// When used in a template, named items are created in the output figure in
+ /// addition to any items the figure already has in this array. You can
+ /// modify these items in the output figure by making your own item with
+ /// `templateitemname` matching this `name` alongside your modifications
+ /// (including `visible: false` or `enabled: false` to hide it). Has no
+ /// effect outside of a template.
name: Option,
- /// Used to refer to a named item in this array in the template. Named items from the template
- /// will be created even without a matching item in the input figure, but you can modify one
- /// by making an item with `templateitemname` matching its `name`, alongside your modifications
- /// (including `visible: false` or `enabled: false` to hide it). If there is no template or no
- /// matching item, this item will be hidden unless you explicitly show it with `visible: true`.
+ /// Used to refer to a named item in this array in the template. Named items
+ /// from the template will be created even without a matching item in
+ /// the input figure, but you can modify one by making an item with
+ /// `templateitemname` matching its `name`, alongside your modifications
+ /// (including `visible: false` or `enabled: false` to hide it). If there is
+ /// no template or no matching item, this item will be hidden unless you
+ /// explicitly show it with `visible: true`.
#[serde(rename = "templateitemname")]
template_item_name: Option,
}
@@ -873,13 +895,14 @@ impl Shape {
Default::default()
}
- /// Specifies the shape type to be drawn. If "line", a line is drawn from (`x0`,`y0`) to
- /// (`x1`,`y1`) with respect to the axes' sizing mode. If "circle", a circle is drawn from
- /// ((`x0`+`x1`)/2, (`y0`+`y1`)/2)) with radius (|(`x0`+`x1`)/2 - `x0`|, |(`y0`+`y1`)/2 -`y0`)|)
- /// with respect to the axes' sizing mode. If "rect", a rectangle is drawn linking
- /// (`x0`,`y0`), (`x1`,`y0`), (`x1`,`y1`), (`x0`,`y1`), (`x0`,`y0`) with respect to the axes'
- /// sizing mode. If "path", draw a custom SVG path using `path`. with respect to the axes'
- /// sizing mode.
+ /// Specifies the shape type to be drawn. If "line", a line is drawn from
+ /// (`x0`,`y0`) to (`x1`,`y1`) with respect to the axes' sizing mode. If
+ /// "circle", a circle is drawn from ((`x0`+`x1`)/2, (`y0`+`y1`)/2))
+ /// with radius (|(`x0`+`x1`)/2 - `x0`|, |(`y0`+`y1`)/2 -`y0`)|)
+ /// with respect to the axes' sizing mode. If "rect", a rectangle is drawn
+ /// linking (`x0`,`y0`), (`x1`,`y0`), (`x1`,`y1`), (`x0`,`y1`),
+ /// (`x0`,`y0`) with respect to the axes' sizing mode. If "path", draw a
+ /// custom SVG path using `path`. with respect to the axes' sizing mode.
pub fn shape_type(mut self, shape_type: ShapeType) -> Self {
self.r#type = Some(shape_type);
self
@@ -900,9 +923,10 @@ pub enum DrawDirection {
pub struct NewShape {
/// Sets the shape line properties (`color`, `width`, `dash`).
line: Option,
- /// Sets the color filling new shapes' interior. Please note that if using a fillcolor with
- /// alpha greater than half, drag inside the active shape starts moving the shape underneath,
- /// otherwise a new shape could be started over.
+ /// Sets the color filling new shapes' interior. Please note that if using a
+ /// fillcolor with alpha greater than half, drag inside the active shape
+ /// starts moving the shape underneath, otherwise a new shape could be
+ /// started over.
#[serde(rename = "fillcolor")]
fill_color: Option>,
/// Determines the path's interior. For more info please
@@ -913,10 +937,12 @@ pub struct NewShape {
opacity: Option,
/// Specifies whether new shapes are drawn below or above traces.
layer: Option,
- /// When `dragmode` is set to "drawrect", "drawline" or "drawcircle" this limits the drag to be
- /// horizontal, vertical or diagonal. Using "diagonal" there is no limit e.g. in drawing lines
- /// in any direction. "ortho" limits the draw to be either horizontal or vertical. "horizontal"
- /// allows horizontal extend. "vertical" allows vertical extend.
+ /// When `dragmode` is set to "drawrect", "drawline" or "drawcircle" this
+ /// limits the drag to be horizontal, vertical or diagonal. Using
+ /// "diagonal" there is no limit e.g. in drawing lines in any direction.
+ /// "ortho" limits the draw to be either horizontal or vertical.
+ /// "horizontal" allows horizontal extend. "vertical" allows vertical
+ /// extend.
#[serde(rename = "drawdirection")]
draw_direction: Option,
}
@@ -933,7 +959,8 @@ pub struct ActiveShape {
/// Sets the color filling the active shape' interior.
#[serde(rename = "fillcolor")]
fill_color: Option>,
- /// Sets the opacity of the active shape. Number between or equal to 0 and 1.
+ /// Sets the opacity of the active shape. Number between or equal to 0 and
+ /// 1.
opacity: Option,
}
@@ -978,29 +1005,33 @@ impl Serialize for ClickToShow {
pub struct Annotation {
/// Determines whether or not this annotation is visible.
visible: Option,
- /// Sets the text associated with this annotation. Plotly uses a subset of HTML tags to do
- /// things like newline ( ), bold (), italics (), hyperlinks
- /// (). Tags , , are also supported.
+ /// Sets the text associated with this annotation. Plotly uses a subset of
+ /// HTML tags to do things like newline ( ), bold (), italics
+ /// (), hyperlinks (). Tags , ,
+ /// are also supported.
text: Option,
- /// Sets the angle at which the `text` is drawn with respect to the horizontal.
+ /// Sets the angle at which the `text` is drawn with respect to the
+ /// horizontal.
#[serde(rename = "textangle")]
text_angle: Option,
/// Sets the annotation text font.
font: Option,
- /// Sets an explicit width for the text box. null (default) lets the text set the box width.
- /// Wider text will be clipped. There is no automatic wrapping; use to start a new line.
+ /// Sets an explicit width for the text box. null (default) lets the text
+ /// set the box width. Wider text will be clipped. There is no automatic
+ /// wrapping; use to start a new line.
width: Option,
- /// Sets an explicit height for the text box. null (default) lets the text set the box height.
- /// Taller text will be clipped.
+ /// Sets an explicit height for the text box. null (default) lets the text
+ /// set the box height. Taller text will be clipped.
height: Option,
/// Sets the opacity of the annotation (text + arrow).
opacity: Option,
- /// Sets the horizontal alignment of the `text` within the box. Has an effect only if `text`
- /// spans two or more lines (i.e. `text` contains one or more HTML tags) or if an explicit
- /// width is set to override the text width.
+ /// Sets the horizontal alignment of the `text` within the box. Has an
+ /// effect only if `text` spans two or more lines (i.e. `text` contains
+ /// one or more HTML tags) or if an explicit width is set to
+ /// override the text width.
align: Option,
- /// Sets the vertical alignment of the `text` within the box. Has an effect only if an explicit
- /// height is set to override the text height.
+ /// Sets the vertical alignment of the `text` within the box. Has an effect
+ /// only if an explicit height is set to override the text height.
valign: Option,
/// Sets the background color of the annotation.
#[serde(rename = "bgcolor")]
@@ -1014,157 +1045,186 @@ pub struct Annotation {
/// Sets the width (in px) of the border enclosing the annotation `text`.
#[serde(rename = "borderwidth")]
border_width: Option,
- /// Determines whether or not the annotation is drawn with an arrow. If "True", `text` is
- /// placed near the arrow's tail. If "False", `text` lines up with the `x` and `y` provided.
+ /// Determines whether or not the annotation is drawn with an arrow. If
+ /// "True", `text` is placed near the arrow's tail. If "False", `text`
+ /// lines up with the `x` and `y` provided.
#[serde(rename = "showarrow")]
show_arrow: Option,
/// Sets the color of the annotation arrow.
#[serde(rename = "arrowcolor")]
arrow_color: Option>,
- /// Sets the end annotation arrow head style. Integer between or equal to 0 and 8.
+ /// Sets the end annotation arrow head style. Integer between or equal to 0
+ /// and 8.
#[serde(rename = "arrowhead")]
arrow_head: Option,
- /// Sets the start annotation arrow head style. Integer between or equal to 0 and 8.
+ /// Sets the start annotation arrow head style. Integer between or equal to
+ /// 0 and 8.
#[serde(rename = "startarrowhead")]
start_arrow_head: Option,
/// Sets the annotation arrow head position.
#[serde(rename = "arrowside")]
arrow_side: Option,
- /// Sets the size of the end annotation arrow head, relative to `arrowwidth`. A value of 1
- /// (default) gives a head about 3x as wide as the line.
+ /// Sets the size of the end annotation arrow head, relative to
+ /// `arrowwidth`. A value of 1 (default) gives a head about 3x as wide
+ /// as the line.
#[serde(rename = "arrowsize")]
arrow_size: Option,
- /// Sets the size of the start annotation arrow head, relative to `arrowwidth`. A value of 1
- /// (default) gives a head about 3x as wide as the line.
+ /// Sets the size of the start annotation arrow head, relative to
+ /// `arrowwidth`. A value of 1 (default) gives a head about 3x as wide
+ /// as the line.
#[serde(rename = "startarrowsize")]
start_arrow_size: Option,
/// Sets the width (in px) of annotation arrow line.
#[serde(rename = "arrowwidth")]
arrow_width: Option,
- /// Sets a distance, in pixels, to move the end arrowhead away from the position it is pointing
- /// at, for example to point at the edge of a marker independent of zoom. Note that this
- /// shortens the arrow from the `ax` / `ay` vector, in contrast to `xshift` / `yshift` which
+ /// Sets a distance, in pixels, to move the end arrowhead away from the
+ /// position it is pointing at, for example to point at the edge of a
+ /// marker independent of zoom. Note that this shortens the arrow from
+ /// the `ax` / `ay` vector, in contrast to `xshift` / `yshift` which
/// moves everything by this amount.
#[serde(rename = "standoff")]
stand_off: Option,
- /// Sets a distance, in pixels, to move the start arrowhead away from the position it is
- /// pointing at, for example to point at the edge of a marker independent of zoom. Note that
- /// this shortens the arrow from the `ax` / `ay` vector, in contrast to `xshift` / `yshift`
+ /// Sets a distance, in pixels, to move the start arrowhead away from the
+ /// position it is pointing at, for example to point at the edge of a
+ /// marker independent of zoom. Note that this shortens the arrow from
+ /// the `ax` / `ay` vector, in contrast to `xshift` / `yshift`
/// which moves everything by this amount.
#[serde(rename = "startstandoff")]
start_stand_off: Option,
- /// Sets the x component of the arrow tail about the arrow head. If `axref` is `pixel`, a
- /// positive (negative) component corresponds to an arrow pointing from right to left (left
- /// to right). If `axref` is an axis, this is an absolute value on that axis, like `x`, NOT a
+ /// Sets the x component of the arrow tail about the arrow head. If `axref`
+ /// is `pixel`, a positive (negative) component corresponds to an arrow
+ /// pointing from right to left (left to right). If `axref` is an axis,
+ /// this is an absolute value on that axis, like `x`, NOT a
/// relative value.
ax: Option,
- /// Sets the y component of the arrow tail about the arrow head. If `ayref` is `pixel`, a
- /// positive (negative) component corresponds to an arrow pointing from bottom to top (top to
- /// bottom). If `ayref` is an axis, this is an absolute value on that axis, like `y`, NOT a
+ /// Sets the y component of the arrow tail about the arrow head. If `ayref`
+ /// is `pixel`, a positive (negative) component corresponds to an arrow
+ /// pointing from bottom to top (top to bottom). If `ayref` is an axis,
+ /// this is an absolute value on that axis, like `y`, NOT a
/// relative value.
ay: Option,
- /// Indicates in what terms the tail of the annotation (ax,ay) is specified. If `pixel`, `ax`
- /// is a relative offset in pixels from `x`. If set to an x axis id (e.g. "x" or "x2"), `ax` is
- /// specified in the same terms as that axis. This is useful for trendline annotations which
+ /// Indicates in what terms the tail of the annotation (ax,ay) is specified.
+ /// If `pixel`, `ax` is a relative offset in pixels from `x`. If set to
+ /// an x axis id (e.g. "x" or "x2"), `ax` is specified in the same terms
+ /// as that axis. This is useful for trendline annotations which
/// should continue to indicate the correct trend when zoomed.
#[serde(rename = "axref")]
ax_ref: Option,
- /// Indicates in what terms the tail of the annotation (ax,ay) is specified. If `pixel`, `ay`
- /// is a relative offset in pixels from `y`. If set to a y axis id (e.g. "y" or "y2"), `ay` is
- /// specified in the same terms as that axis. This is useful for trendline annotations which
+ /// Indicates in what terms the tail of the annotation (ax,ay) is specified.
+ /// If `pixel`, `ay` is a relative offset in pixels from `y`. If set to
+ /// a y axis id (e.g. "y" or "y2"), `ay` is specified in the same terms
+ /// as that axis. This is useful for trendline annotations which
/// should continue to indicate the correct trend when zoomed.
#[serde(rename = "ayref")]
ay_ref: Option,
- /// Sets the annotation's x coordinate axis. If set to an x axis id (e.g. "x" or "x2"), the `x`
- /// position refers to an x coordinate If set to "paper", the `x` position refers to the
- /// distance from the left side of the plotting area in normalized coordinates where 0 (1)
+ /// Sets the annotation's x coordinate axis. If set to an x axis id (e.g.
+ /// "x" or "x2"), the `x` position refers to an x coordinate If set to
+ /// "paper", the `x` position refers to the distance from the left side
+ /// of the plotting area in normalized coordinates where 0 (1)
/// corresponds to the left (right) side.
#[serde(rename = "xref")]
x_ref: Option,
- /// Sets the annotation's x position. If the axis `type` is "log", then you must take the log
- /// of your desired range. If the axis `type` is "date", it should be date strings, like date
- /// data, though Date objects and unix milliseconds will be accepted and converted to strings.
- /// If the axis `type` is "category", it should be numbers, using the scale where each category
- /// is assigned a serial number from zero in the order it appears.
+ /// Sets the annotation's x position. If the axis `type` is "log", then you
+ /// must take the log of your desired range. If the axis `type` is
+ /// "date", it should be date strings, like date data, though Date
+ /// objects and unix milliseconds will be accepted and converted to strings.
+ /// If the axis `type` is "category", it should be numbers, using the scale
+ /// where each category is assigned a serial number from zero in the
+ /// order it appears.
x: Option,
- /// Sets the text box's horizontal position anchor This anchor binds the `x` position to the
- /// "left", "center" or "right" of the annotation. For example, if `x` is set to 1, `xref` to
- /// "paper" and `xanchor` to "right" then the right-most portion of the annotation lines up with
- /// the right-most edge of the plotting area. If "auto", the anchor is equivalent to "center"
- /// for data-referenced annotations or if there is an arrow, whereas for paper-referenced with
- /// no arrow, the anchor picked corresponds to the closest side.
+ /// Sets the text box's horizontal position anchor This anchor binds the `x`
+ /// position to the "left", "center" or "right" of the annotation. For
+ /// example, if `x` is set to 1, `xref` to "paper" and `xanchor` to
+ /// "right" then the right-most portion of the annotation lines up with
+ /// the right-most edge of the plotting area. If "auto", the anchor is
+ /// equivalent to "center" for data-referenced annotations or if there
+ /// is an arrow, whereas for paper-referenced with no arrow, the anchor
+ /// picked corresponds to the closest side.
#[serde(rename = "xanchor")]
x_anchor: Option,
- /// Shifts the position of the whole annotation and arrow to the right (positive) or left
- /// (negative) by this many pixels.
+ /// Shifts the position of the whole annotation and arrow to the right
+ /// (positive) or left (negative) by this many pixels.
#[serde(rename = "xshift")]
x_shift: Option,
- /// Sets the annotation's y coordinate axis. If set to an y axis id (e.g. "y" or "y2"), the `y`
- /// position refers to an y coordinate If set to "paper", the `y` position refers to the
- /// distance from the bottom of the plotting area in normalized coordinates where 0 (1)
- /// corresponds to the bottom (top).
+ /// Sets the annotation's y coordinate axis. If set to an y axis id (e.g.
+ /// "y" or "y2"), the `y` position refers to an y coordinate If set to
+ /// "paper", the `y` position refers to the distance from the bottom of
+ /// the plotting area in normalized coordinates where 0 (1) corresponds
+ /// to the bottom (top).
#[serde(rename = "yref")]
y_ref: Option,
- /// Sets the annotation's y position. If the axis `type` is "log", then you must take the log of
- /// your desired range. If the axis `type` is "date", it should be date strings, like date data,
- /// though Date objects and unix milliseconds will be accepted and converted to strings. If the
- /// axis `type` is "category", it should be numbers, using the scale where each category is
- /// assigned a serial number from zero in the order it appears.
+ /// Sets the annotation's y position. If the axis `type` is "log", then you
+ /// must take the log of your desired range. If the axis `type` is
+ /// "date", it should be date strings, like date data, though Date
+ /// objects and unix milliseconds will be accepted and converted to strings.
+ /// If the axis `type` is "category", it should be numbers, using the
+ /// scale where each category is assigned a serial number from zero in
+ /// the order it appears.
y: Option,
- /// Sets the text box's vertical position anchor This anchor binds the `y` position to the
- /// "top", "middle" or "bottom" of the annotation. For example, if `y` is set to 1, `yref` to
- /// "paper" and `yanchor` to "top" then the top-most portion of the annotation lines up with the
- /// top-most edge of the plotting area. If "auto", the anchor is equivalent to "middle" for
- /// data-referenced annotations or if there is an arrow, whereas for paper-referenced with no
- /// arrow, the anchor picked corresponds to the closest side.
+ /// Sets the text box's vertical position anchor This anchor binds the `y`
+ /// position to the "top", "middle" or "bottom" of the annotation. For
+ /// example, if `y` is set to 1, `yref` to "paper" and `yanchor` to
+ /// "top" then the top-most portion of the annotation lines up with the
+ /// top-most edge of the plotting area. If "auto", the anchor is equivalent
+ /// to "middle" for data-referenced annotations or if there is an arrow,
+ /// whereas for paper-referenced with no arrow, the anchor picked
+ /// corresponds to the closest side.
#[serde(rename = "yanchor")]
y_anchor: Option,
- /// Shifts the position of the whole annotation and arrow up (positive) or down (negative) by
- /// this many pixels.
+ /// Shifts the position of the whole annotation and arrow up (positive) or
+ /// down (negative) by this many pixels.
#[serde(rename = "yshift")]
y_shift: Option,
- /// Makes this annotation respond to clicks on the plot. If you click a data point that exactly
- /// matches the `x` and `y` values of this annotation, and it is hidden (visible: false), it
- /// will appear. In "onoff" mode, you must click the same point again to make it disappear, so
- /// if you click multiple points, you can show multiple annotations. In "onout" mode, a click
- /// anywhere else in the plot (on another data point or not) will hide this annotation. If you
- /// need to show/hide this annotation in response to different `x` or `y` values, you can set
- /// `xclick` and/or `yclick`. This is useful for example to label the side of a bar. To label
- /// markers though, `standoff` is preferred over `xclick` and `yclick`.
+ /// Makes this annotation respond to clicks on the plot. If you click a data
+ /// point that exactly matches the `x` and `y` values of this
+ /// annotation, and it is hidden (visible: false), it will appear. In
+ /// "onoff" mode, you must click the same point again to make it disappear,
+ /// so if you click multiple points, you can show multiple annotations.
+ /// In "onout" mode, a click anywhere else in the plot (on another data
+ /// point or not) will hide this annotation. If you need to show/hide
+ /// this annotation in response to different `x` or `y` values, you can set
+ /// `xclick` and/or `yclick`. This is useful for example to label the side
+ /// of a bar. To label markers though, `standoff` is preferred over
+ /// `xclick` and `yclick`.
#[serde(rename = "clicktoshow")]
click_to_show: Option,
- /// Toggle this annotation when clicking a data point whose `x` value is `xclick` rather than
- /// the annotation's `x` value.
+ /// Toggle this annotation when clicking a data point whose `x` value is
+ /// `xclick` rather than the annotation's `x` value.
#[serde(rename = "xclick")]
x_click: Option,
- /// Toggle this annotation when clicking a data point whose `y` value is `yclick` rather than
- /// the annotation's `y` value.
+ /// Toggle this annotation when clicking a data point whose `y` value is
+ /// `yclick` rather than the annotation's `y` value.
#[serde(rename = "yclick")]
y_click: Option,
- /// Sets text to appear when hovering over this annotation. If omitted or blank, no hover label
- /// will appear.
+ /// Sets text to appear when hovering over this annotation. If omitted or
+ /// blank, no hover label will appear.
#[serde(rename = "hovertext")]
hover_text: Option,
/// Label displayed on mouse hover.
#[serde(rename = "hoverlabel")]
hover_label: Option