Skip to content

Commit 096f4bf

Browse files
committed
Split TraceMap type, add subplotid settings and add TraceID
1 parent 2b75b23 commit 096f4bf

15 files changed

+500
-70
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ type Chart =
9595

9696
fun (ch:GenericChart) ->
9797
ch |> mapTrace (fun trace ->
98-
trace
99-
|> TraceStyle.SetAxisAnchor(?X=idx,?Y=idy)
98+
match trace with
99+
| :? Trace2D as trace -> trace |> Trace2DStyle.SetAxisAnchor(?X=idx,?Y=idy) :> Trace
100+
| _ ->
101+
printfn "the input was not a 2D cartesian trace. no axis anchors set."
102+
trace
100103
)
101104
[<CompiledName("WithAxisAnchor")>]
102105
static member withAxisAnchor
@@ -562,7 +565,7 @@ type Chart =
562565
static member withMapbox(mapBox:Mapbox,[<Optional;DefaultParameterValue(null)>] ?Id:StyleParam.SubPlotId ) =
563566
(fun (ch:GenericChart) ->
564567
let layout =
565-
let id = defaultArg Id (StyleParam.SubPlotId.MapBox 1)
568+
let id = defaultArg Id (StyleParam.SubPlotId.Mapbox 1)
566569
GenericChart.getLayout ch
567570
|> Layout.UpdateMapboxById(id,mapBox)
568571
GenericChart.setLayout layout ch

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

+26-26
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ module ChartMap =
2929
[<Optional;DefaultParameterValue(null)>] ?Zmin,
3030
[<Optional;DefaultParameterValue(null)>] ?Zmax) =
3131

32-
TraceMap.initChoroplethMap (
33-
TraceMapStyle.ChoroplethMap(
32+
TraceGeo.initChoroplethMap (
33+
TraceGeoStyle.ChoroplethMap(
3434
Locations=locations,
3535
Z=z,
3636
?Text=Text,
@@ -102,8 +102,8 @@ module ChartMap =
102102
[<Optional;DefaultParameterValue(null)>] ?Fillcolor
103103
) =
104104

105-
TraceMap.initScatterGeo(
106-
TraceMapStyle.ScatterGeo(
105+
TraceGeo.initScatterGeo(
106+
TraceGeoStyle.ScatterGeo(
107107
mode = mode ,
108108
Longitudes = longitudes ,
109109
Latitudes = latitudes ,
@@ -176,8 +176,8 @@ module ChartMap =
176176
) =
177177
let longitudes, latitudes = Seq.unzip lonlat
178178

179-
TraceMap.initScatterGeo(
180-
TraceMapStyle.ScatterGeo(
179+
TraceGeo.initScatterGeo(
180+
TraceGeoStyle.ScatterGeo(
181181
mode = mode ,
182182
Longitudes = longitudes ,
183183
Latitudes = latitudes ,
@@ -248,8 +248,8 @@ module ChartMap =
248248
[<Optional;DefaultParameterValue(null)>] ?Fillcolor
249249
) =
250250

251-
TraceMap.initScatterGeo(
252-
TraceMapStyle.ScatterGeo(
251+
TraceGeo.initScatterGeo(
252+
TraceGeoStyle.ScatterGeo(
253253
mode = mode ,
254254
?Locations = locations ,
255255
?GeoJson = GeoJson ,
@@ -314,8 +314,8 @@ module ChartMap =
314314

315315
let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
316316

317-
TraceMap.initScatterGeo(
318-
TraceMapStyle.ScatterGeo(
317+
TraceGeo.initScatterGeo(
318+
TraceGeoStyle.ScatterGeo(
319319
mode = changeMode StyleParam.Mode.Markers ,
320320
Longitudes = longitudes ,
321321
Latitudes = latitudes ,
@@ -379,8 +379,8 @@ module ChartMap =
379379
let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
380380
let longitudes, latitudes = Seq.unzip lonlat
381381

382-
TraceMap.initScatterGeo(
383-
TraceMapStyle.ScatterGeo(
382+
TraceGeo.initScatterGeo(
383+
TraceGeoStyle.ScatterGeo(
384384
mode = changeMode StyleParam.Mode.Markers ,
385385
Longitudes = longitudes ,
386386
Latitudes = latitudes ,
@@ -443,8 +443,8 @@ module ChartMap =
443443

444444
let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
445445

446-
TraceMap.initScatterGeo(
447-
TraceMapStyle.ScatterGeo(
446+
TraceGeo.initScatterGeo(
447+
TraceGeoStyle.ScatterGeo(
448448
mode = changeMode StyleParam.Mode.Markers ,
449449
?Locations = locations ,
450450
?GeoJson = GeoJson ,
@@ -522,8 +522,8 @@ module ChartMap =
522522
StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
523523
>> StyleParam.ModeUtils.showMarker (isShowMarker)
524524

525-
TraceMap.initScatterGeo(
526-
TraceMapStyle.ScatterGeo(
525+
TraceGeo.initScatterGeo(
526+
TraceGeoStyle.ScatterGeo(
527527
mode = changeMode StyleParam.Mode.Lines,
528528
Longitudes = longitudes ,
529529
Latitudes = latitudes ,
@@ -598,8 +598,8 @@ module ChartMap =
598598
>> StyleParam.ModeUtils.showMarker (isShowMarker)
599599
let longitudes, latitudes = Seq.unzip lonlat
600600

601-
TraceMap.initScatterGeo(
602-
TraceMapStyle.ScatterGeo(
601+
TraceGeo.initScatterGeo(
602+
TraceGeoStyle.ScatterGeo(
603603
mode = changeMode StyleParam.Mode.Lines,
604604
Longitudes = longitudes ,
605605
Latitudes = latitudes ,
@@ -674,8 +674,8 @@ module ChartMap =
674674
StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
675675
>> StyleParam.ModeUtils.showMarker (isShowMarker)
676676

677-
TraceMap.initScatterGeo(
678-
TraceMapStyle.ScatterGeo(
677+
TraceGeo.initScatterGeo(
678+
TraceGeoStyle.ScatterGeo(
679679
mode = changeMode StyleParam.Mode.Lines,
680680
Locations = locations ,
681681
?GeoJson = GeoJson ,
@@ -731,8 +731,8 @@ module ChartMap =
731731
[<Optional;DefaultParameterValue(null)>] ?Fillcolor
732732
) =
733733

734-
TraceMap.initScatterMapbox(
735-
TraceMapStyle.ScatterMapbox(
734+
TraceMapbox.initScatterMapbox(
735+
TraceMapboxStyle.ScatterMapbox(
736736
mode = mode ,
737737
Longitudes = longitudes ,
738738
Latitudes = latitudes ,
@@ -1079,8 +1079,8 @@ module ChartMap =
10791079
[<Optional;DefaultParameterValue(null)>] ?ZMax
10801080
) =
10811081

1082-
TraceMap.initChoroplethMapbox (
1083-
TraceMapStyle.ChoroplethMapbox (
1082+
TraceMapbox.initChoroplethMapbox (
1083+
TraceMapboxStyle.ChoroplethMapbox (
10841084
Z = z,
10851085
Locations = locations,
10861086
GeoJson = geoJson,
@@ -1128,8 +1128,8 @@ module ChartMap =
11281128
[<Optional;DefaultParameterValue(null)>] ?ZMid,
11291129
[<Optional;DefaultParameterValue(null)>] ?ZMax
11301130
) =
1131-
TraceMap.initDensityMapbox(
1132-
TraceMapStyle.DensityMapbox(
1131+
TraceMapbox.initDensityMapbox(
1132+
TraceMapboxStyle.DensityMapbox(
11331133
Longitudes = lon,
11341134
Latitudes = lat,
11351135
?Z = Z,

Diff for: src/Plotly.NET/CommonAbstractions/StyleParams.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ module StyleParam =
107107
| YAxis of int
108108
| ColorAxis of int
109109
| Geo of int
110-
| MapBox of int
110+
| Mapbox of int
111111
| Polar of int
112112
| Ternary of int
113113
| Scene of int
@@ -117,7 +117,7 @@ module StyleParam =
117117
| YAxis id -> if id < 2 then "yaxis" else sprintf "yaxis%i" id
118118
| ColorAxis id -> if id < 2 then "coloraxis" else sprintf "coloraxis%i" id
119119
| Geo id -> if id < 2 then "geo" else sprintf "geo%i" id
120-
| MapBox id -> if id < 2 then "mapbox" else sprintf "mapbox%i" id
120+
| Mapbox id -> if id < 2 then "mapbox" else sprintf "mapbox%i" id
121121
| Polar id -> if id < 2 then "polar" else sprintf "polar%i" id
122122
| Ternary id -> if id < 2 then "ternary" else sprintf "ternary%i" id
123123
| Scene id -> if id < 2 then "scene" else sprintf "scene%i" id

0 commit comments

Comments
 (0)