plotly/
lib.rs

1//! # Plotly.rs
2//!
3//! A plotting library for Rust powered by [Plotly.js](https://plot.ly/javascript/).
4//!
5//! ## Feature Deprecation Notice
6//!
7//! The `kaleido` and `kaleido_download` features are deprecated since version
8//! 0.13.0 and will be removed in version 0.14.0. Please migrate to the
9//! `plotly_static` and `static_export_*` features instead.
10#![recursion_limit = "256"] // lets us use a large serde_json::json! macro for testing crate::layout::Axis
11extern crate askama;
12extern crate rand;
13extern crate serde;
14
15#[cfg(feature = "kaleido")]
16#[deprecated(
17    since = "0.13.0",
18    note = "kaleido feature is deprecated and will be removed in version 0.14.0. Use plotly_static feature instead"
19)]
20const _KALEIDO_DEPRECATED: () = ();
21
22#[cfg(feature = "kaleido_download")]
23#[deprecated(
24    since = "0.13.0",
25    note = "kaleido_download feature is deprecated and will be removed in version 0.14.0. Use plotly_static_download feature instead"
26)]
27const _KALEIDO_DOWNLOAD_DEPRECATED: () = ();
28
29#[cfg(all(feature = "kaleido", target_family = "wasm"))]
30compile_error!(
31    r#"The "kaleido" feature is not available on "wasm" targets. Please compile without this feature for the wasm target family."#
32);
33
34#[cfg(all(feature = "kaleido", feature = "plotly_static"))]
35compile_error!(
36    r#"The "kaleido" feature and "plotly_static" are conflictings. Please select only one of them."#
37);
38
39#[cfg(feature = "plotly_ndarray")]
40pub mod ndarray;
41#[cfg(feature = "plotly_ndarray")]
42pub use crate::ndarray::ArrayTraces;
43
44#[cfg(target_family = "wasm")]
45pub mod bindings;
46
47#[cfg(target_family = "wasm")]
48pub mod callbacks;
49
50pub mod common;
51pub mod configuration;
52pub mod export;
53pub mod layout;
54pub mod plot;
55pub mod traces;
56
57pub use common::color;
58pub use configuration::Configuration;
59pub use layout::Layout;
60pub use plot::{Plot, Trace, Traces};
61// Also provide easy access to modules which contain additional trace-specific types
62pub use traces::{
63    box_plot, contour, heat_map, histogram, image, mesh3d, sankey, scatter, scatter3d,
64    scatter_mapbox, surface,
65};
66// Bring the different trace types into the top-level scope
67pub use traces::{
68    Bar, BoxPlot, Candlestick, Contour, DensityMapbox, HeatMap, Histogram, Image, Mesh3D, Ohlc,
69    Pie, Sankey, Scatter, Scatter3D, ScatterGeo, ScatterMapbox, ScatterPolar, Surface, Table,
70};
71
72pub trait Restyle: serde::Serialize {}
73pub trait Relayout {}
74
75#[cfg(feature = "kaleido")]
76pub use plotly_kaleido::ImageFormat;
77#[cfg(feature = "plotly_static")]
78pub use plotly_static::{self, ImageFormat};
79
80// Public prelude for ergonomic imports in examples and user code
81pub mod prelude {
82    #[cfg(feature = "plotly_static")]
83    pub use crate::export::r#async::ExporterAsyncExt;
84    #[cfg(feature = "plotly_static")]
85    pub use crate::export::sync::ExporterSyncExt;
86    #[cfg(feature = "plotly_static")]
87    pub use crate::plotly_static::ImageFormat;
88}
89
90// Not public API.
91#[doc(hidden)]
92mod private;