Skip to content

Commit 36f98f3

Browse files
committed
Finish Geo choropleth trace and chart, tests, and docs
1 parent 185c7c8 commit 36f98f3

File tree

6 files changed

+217
-74
lines changed

6 files changed

+217
-74
lines changed

Diff for: docs/05_0_geo-vs-mapbox.fsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ In the default plotly template, a map frame and physical features such as a coas
5050
open Plotly.NET
5151

5252
let baseMapOnly =
53-
Chart.PointGeo([]) // deliberately empty chart to show the base map only
53+
Chart.PointGeo(locations = []) // deliberately empty chart to show the base map only
5454
|> Chart.withMarginSize(0,0,0,0)
5555

5656
(*** condition: ipynb ***)
@@ -84,7 +84,7 @@ let myGeo =
8484
)
8585

8686
let moreFeaturesBaseMap =
87-
Chart.PointGeo([])
87+
Chart.PointGeo(locations = [])
8888
|> Chart.withGeo myGeo
8989
|> Chart.withMarginSize(0,0,0,0)
9090

@@ -119,7 +119,7 @@ let countryGeo =
119119

120120

121121
let countryBaseMap =
122-
Chart.PointGeo([])
122+
Chart.PointGeo(locations = [])
123123
|> Chart.withGeo countryGeo
124124
|> Chart.withMarginSize(0,0,0,0)
125125

Diff for: docs/05_1_geo-plots.fsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let pointGeo =
5858
Chart.PointGeo(
5959
lon,
6060
lat,
61-
Labels=cityNames,
61+
MultiText=cityNames,
6262
TextPosition=StyleParam.TextPosition.TopCenter
6363
)
6464
|> Chart.withGeoStyle(
@@ -106,7 +106,7 @@ let flights =
106106
Chart.LineGeo(
107107
[startCoords; endCoords],
108108
Opacity = opacityVals.[i],
109-
Color = Color.fromString "red"
109+
MarkerColor = Color.fromString "red"
110110
)
111111
)
112112
|> Chart.combine

Diff for: src/Plotly.NET/ChartAPI/ChartMap.fs

+27-23
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,39 @@ module ChartMap =
2323
static member ChoroplethMap
2424
(
2525
locations,z,
26-
[<Optional;DefaultParameterValue(null)>] ?Text,
27-
[<Optional;DefaultParameterValue(null)>] ?Locationmode,
28-
[<Optional;DefaultParameterValue(null)>] ?Autocolorscale,
29-
[<Optional;DefaultParameterValue(null)>] ?Colorscale,
30-
[<Optional;DefaultParameterValue(null)>] ?ColorBar,
31-
[<Optional;DefaultParameterValue(null)>] ?Marker,
32-
[<Optional;DefaultParameterValue(null)>] ?GeoJson,
33-
[<Optional;DefaultParameterValue(null)>] ?FeatureIdKey: string,
34-
[<Optional;DefaultParameterValue(null)>] ?Zmin,
35-
[<Optional;DefaultParameterValue(null)>] ?Zmax,
36-
[<Optional;DefaultParameterValue(true)>] ?UseDefaults : bool
26+
[<Optional;DefaultParameterValue(null)>] ?Name : string,
27+
[<Optional;DefaultParameterValue(null)>] ?ShowLegend : bool,
28+
[<Optional;DefaultParameterValue(null)>] ?GeoJson : obj,
29+
[<Optional;DefaultParameterValue(null)>] ?FeatureIdKey : string,
30+
[<Optional;DefaultParameterValue(null)>] ?Text : #IConvertible,
31+
[<Optional;DefaultParameterValue(null)>] ?MultiText : seq<#IConvertible>,
32+
[<Optional;DefaultParameterValue(null)>] ?ColorBar : ColorBar,
33+
[<Optional;DefaultParameterValue(null)>] ?AutoColorScale : bool,
34+
[<Optional;DefaultParameterValue(null)>] ?ColorScale : StyleParam.Colorscale,
35+
[<Optional;DefaultParameterValue(null)>] ?ShowScale : bool,
36+
[<Optional;DefaultParameterValue(null)>] ?ReverseScale : bool,
37+
[<Optional;DefaultParameterValue(null)>] ?LocationMode : StyleParam.LocationFormat,
38+
[<Optional;DefaultParameterValue(true)>] ?UseDefaults : bool
3739
) =
3840

3941
let useDefaults = defaultArg UseDefaults true
4042

4143
TraceGeo.initChoroplethMap (
4244
TraceGeoStyle.ChoroplethMap(
43-
Locations=locations,
44-
Z=z,
45-
?Text=Text,
46-
?Locationmode=Locationmode,
47-
?Autocolorscale=Autocolorscale,
48-
?Colorscale=Colorscale,
49-
?ColorBar=ColorBar,
50-
?Marker=Marker,
51-
?Zmin=Zmin,
52-
?Zmax=Zmax,
53-
?GeoJson=GeoJson,
54-
?FeatureIdKey=FeatureIdKey
45+
Locations = locations ,
46+
Z = z ,
47+
?Name = Name ,
48+
?ShowLegend = ShowLegend ,
49+
?GeoJson = GeoJson ,
50+
?FeatureIdKey = FeatureIdKey ,
51+
?Text = Text ,
52+
?MultiText = MultiText ,
53+
?ColorBar = ColorBar ,
54+
?AutoColorScale = AutoColorScale,
55+
?ColorScale = ColorScale ,
56+
?ShowScale = ShowScale ,
57+
?ReverseScale = ReverseScale ,
58+
?LocationMode = LocationMode
5559
)
5660
)
5761
|> GenericChart.ofTraceObject useDefaults

Diff for: src/Plotly.NET/Templates/ChartTemplates.fs

+16-5
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,23 @@ module ChartTemplates =
396396
)
397397
))
398398

399-
TraceGeo.initChoroplethMap(TraceGeoStyle.ChoroplethMap(
400-
ColorBar = ColorBar.init(
401-
OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty
399+
TraceGeo.initChoroplethMap(
400+
TraceGeoStyle.ChoroplethMap(
401+
ColorBar = ColorBar.init(OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty),
402+
ColorScale = StyleParam.Colorscale.Custom [
403+
0.0 , "#0d0887"
404+
0.1111111111111111 , "#46039f"
405+
0.2222222222222222 , "#7201a8"
406+
0.3333333333333333 , "#9c179e"
407+
0.4444444444444444 , "#bd3786"
408+
0.5555555555555556 , "#d8576b"
409+
0.6666666666666666 , "#ed7953"
410+
0.7777777777777778 , "#fb9f3a"
411+
0.8888888888888888 , "#fdca26"
412+
1.0 , "#f0f921"
413+
]
402414
)
403-
))
404-
415+
)
405416
Trace2D.initContour(Trace2DStyle.Contour(
406417
ColorBar = ColorBar.init(
407418
OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty

0 commit comments

Comments
 (0)