Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- [[#412](https://github.com/plotly/plotly.rs/pull/412)] Add `Violin` trace type with box, mean line, KDE span, and split/grouped support
- [[#414](https://github.com/plotly/plotly.rs/issues/414)] Add `DensityMap` (MapLibre `map` subplot) trace type — density heatmaps with full color-scale and hover support
- [[#417](https://github.com/plotly/plotly.rs/issues/417)] Add `ScatterMap` (MapLibre `map` subplot) trace type — the modern counterpart to `ScatterMapbox`
- Add `Funnel` trace type (bar-like, cartesian) with `Connector` and `FunnelHoverInfo` options, plus the layout-level `funnelmode`/`funnelgap`/`funnelgroupgap` attributes and a `FunnelMode` enum
- [[#418](https://github.com/plotly/plotly.rs/issues/418)] Add native point clustering to `ScatterMap` via a `Cluster` option

### Changed
Expand Down
1 change: 1 addition & 0 deletions plotly/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pub enum PlotType {
Choropleth,
ChoroplethMap,
Contour,
Funnel,
HeatMap,
Histogram,
Histogram2dContour,
Expand Down
9 changes: 8 additions & 1 deletion plotly/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub use self::legend::{GroupClick, ItemClick, ItemSizing, Legend, TraceOrder};
pub use self::map::{LayoutMap, MapBounds, MapStyle};
pub use self::mapbox::{Center, Mapbox, MapboxStyle};
pub use self::modes::{
AspectMode, BarMode, BarNorm, BoxMode, ClickMode, UniformTextMode, ViolinMode, WaterfallMode,
AspectMode, BarMode, BarNorm, BoxMode, ClickMode, FunnelMode, UniformTextMode, ViolinMode,
WaterfallMode,
};
pub use self::polar::{
AngularAxis, AngularAxisType, AutoRange, AutoRangeOptions, AutoTypeNumbers, AxisLayer,
Expand Down Expand Up @@ -379,6 +380,12 @@ pub struct LayoutFields {
waterfall_gap: Option<f64>,
#[serde(rename = "waterfallgroupgap")]
waterfall_group_gap: Option<f64>,
#[serde(rename = "funnelmode")]
funnel_mode: Option<FunnelMode>,
#[serde(rename = "funnelgap")]
funnel_gap: Option<f64>,
#[serde(rename = "funnelgroupgap")]
funnel_group_gap: Option<f64>,
#[serde(rename = "piecolorway")]
pie_colorway: Option<Vec<Box<dyn Color>>>,
#[serde(rename = "extendpiecolors")]
Expand Down
15 changes: 15 additions & 0 deletions plotly/src/layout/modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ pub enum WaterfallMode {
Overlay,
}

#[derive(Serialize, Debug, Clone)]
#[serde(rename_all = "lowercase")]
pub enum FunnelMode {
Stack,
Group,
Overlay,
}

#[derive(Debug, Clone)]
pub enum UniformTextMode {
False,
Expand Down Expand Up @@ -146,6 +154,13 @@ mod tests {
assert_eq!(to_value(WaterfallMode::Overlay).unwrap(), json!("overlay"));
}

#[test]
fn serialize_funnel_mode() {
assert_eq!(to_value(FunnelMode::Stack).unwrap(), json!("stack"));
assert_eq!(to_value(FunnelMode::Group).unwrap(), json!("group"));
assert_eq!(to_value(FunnelMode::Overlay).unwrap(), json!("overlay"));
}

#[test]
fn serialize_aspect_mode() {
let aspect_mode = AspectMode::default();
Expand Down
7 changes: 4 additions & 3 deletions plotly/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ pub use layout::Layout;
pub use plot::{Plot, Trace, Traces};
// Also provide easy access to modules which contain additional trace-specific types
pub use traces::{
box_plot, choropleth, choropleth_map, contour, density_map, heat_map, histogram, image, mesh3d,
sankey, scatter, scatter3d, scatter_map, scatter_mapbox, sunburst, surface, treemap, violin,
box_plot, choropleth, choropleth_map, contour, density_map, funnel, heat_map, histogram, image,
mesh3d, sankey, scatter, scatter3d, scatter_map, scatter_mapbox, sunburst, surface, treemap,
violin,
};
// Bring the different trace types into the top-level scope
pub use traces::{
Bar, BoxPlot, Candlestick, Choropleth, ChoroplethMap, Contour, DensityMap, DensityMapbox,
HeatMap, Histogram, Image, Mesh3D, Ohlc, Pie, Sankey, Scatter, Scatter3D, ScatterGeo,
Funnel, HeatMap, Histogram, Image, Mesh3D, Ohlc, Pie, Sankey, Scatter, Scatter3D, ScatterGeo,
ScatterMap, ScatterMapbox, ScatterPolar, Sunburst, Surface, Table, Treemap, Violin,
};

Expand Down
Loading
Loading