Skip to content

Commit 5e9d82f

Browse files
G0rocksandrei-ng
authored andcommitted
Added a copy of scatter_mapbox.rs and repurposed for scatter_geo, working on making it actually work
1 parent f6732d3 commit 5e9d82f

File tree

6 files changed

+423
-2
lines changed

6 files changed

+423
-2
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to Ploty.rs
1+
# Contributing to Plotly.rs
22

33
Contribution in the form of suggestions, bug reports, pull requests and feedback is welcome from everyone. In this document you'll find guidance if you are considering to offer your help to this project.
44

plotly/src/common/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ pub enum PlotType {
215215
ScatterGL,
216216
Scatter3D,
217217
ScatterMapbox,
218+
ScatterGeo,
218219
ScatterPolar,
219220
ScatterPolarGL,
220221
Bar,
@@ -1750,6 +1751,7 @@ mod tests {
17501751
assert_eq!(to_value(PlotType::Scatter).unwrap(), json!("scatter"));
17511752
assert_eq!(to_value(PlotType::ScatterGL).unwrap(), json!("scattergl"));
17521753
assert_eq!(to_value(PlotType::Scatter3D).unwrap(), json!("scatter3d"));
1754+
assert_eq!(to_value(PlotType::ScatterGeo).unwrap(), json!("scattergeo"));
17531755
assert_eq!(to_value(PlotType::ScatterPolar).unwrap(), json!("scatterpolar"));
17541756
assert_eq!(to_value(PlotType::ScatterPolarGL).unwrap(), json!("scatterpolargl"));
17551757
assert_eq!(to_value(PlotType::Bar).unwrap(), json!("bar"));

plotly/src/layout/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,41 @@ pub enum SelectDirection {
137137
Any,
138138
}
139139

140+
#[derive(Serialize, Clone, Debug, FieldSetter)]
141+
pub struct Geo {
142+
/// Sets the zoom level of the map.
143+
zoom: Option<u8>,
144+
/// Sets the projection of the map
145+
#[field_setter(default = "Projection::new().projection_type(ProjectionType::Orthographic)")]
146+
projection: Option<Projection>,
147+
/// If to show the ocean or not
148+
#[field_setter(default = "Some(true)")]
149+
showocean: Option<bool>,
150+
/// Sets the color of the ocean
151+
#[field_setter(default = "'rgb(0, 255, 255)'")]
152+
oceancolor: Option<Box<dyn Color>>,
153+
/// If to show the land or not
154+
showland: Option<bool>,
155+
/// Sets the color of the land
156+
landcolor: Option<Box<dyn Color>>,
157+
/// If to show lakes or not
158+
showlakes: Option<bool>,
159+
/// Sets the color of the lakes
160+
lakecolor: Option<Box<dyn Color>>,
161+
/// If to show countries (borders) or not
162+
showcountries: Option<bool>,
163+
/// Configures the longitude axis
164+
lonaxis: Option<Axis>,
165+
/// Configures the latitude axis
166+
lataxis: Option<Axis>,
167+
}
168+
169+
impl Geo {
170+
pub fn new() -> Self {
171+
Default::default()
172+
}
173+
}
174+
140175
#[serde_with::skip_serializing_none]
141176
#[derive(Serialize, Debug, Clone, FieldSetter)]
142177
pub struct Template {

plotly/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub use traces::{
4040
// Bring the different trace types into the top-level scope
4141
pub use traces::{
4242
Bar, BoxPlot, Candlestick, Contour, DensityMapbox, HeatMap, Histogram, Image, Mesh3D, Ohlc,
43-
Pie, Sankey, Scatter, Scatter3D, ScatterMapbox, ScatterPolar, Surface, Table,
43+
Pie, Sankey, Scatter, Scatter3D, ScatterGeo, ScatterMapbox, ScatterPolar, Surface, Table,
4444
};
4545

4646
pub trait Restyle: serde::Serialize {}

plotly/src/traces/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub mod pie;
1414
pub mod sankey;
1515
pub mod scatter;
1616
pub mod scatter3d;
17+
pub mod scatter_geo;
1718
pub mod scatter_mapbox;
1819
mod scatter_polar;
1920
pub mod surface;
@@ -32,6 +33,7 @@ pub use pie::Pie;
3233
pub use sankey::Sankey;
3334
pub use scatter::Scatter;
3435
pub use scatter3d::Scatter3D;
36+
pub use scatter_geo::ScatterGeo;
3537
pub use scatter_mapbox::ScatterMapbox;
3638
pub use scatter_polar::ScatterPolar;
3739
pub use surface::Surface;

0 commit comments

Comments
 (0)