Skip to content

Commit dbdf8b6

Browse files
committed
various final adjustments to source, typos, and tests
1 parent bc31d9b commit dbdf8b6

File tree

18 files changed

+121
-106
lines changed

18 files changed

+121
-106
lines changed

src/Plotly.NET/ChartAPI/Chart.fs

+37-34
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ type Chart =
17511751
let currentAxis =
17521752
polar |> Polar.getAngularAxis
17531753

1754-
let updatedAxis = DynObj.combine currentAxis angularAxis
1754+
let updatedAxis = DynObj.combine currentAxis angularAxis |> unbox<AngularAxis>
17551755

17561756
let updatedPolar =
17571757
polar |> Polar.setAngularAxis updatedAxis
@@ -1810,7 +1810,7 @@ type Chart =
18101810
polar |> Polar.getRadialAxis
18111811

18121812
let updatedAxis =
1813-
DynObj.combine currentAxis radialAxis
1813+
DynObj.combine currentAxis radialAxis |> unbox<RadialAxis>
18141814

18151815
let updatedPolar =
18161816
polar |> Polar.setRadialAxis updatedAxis
@@ -1925,10 +1925,10 @@ type Chart =
19251925
let currentAxis =
19261926
smith |> Smith.getImaginaryAxis
19271927

1928-
let updatedAxis = DynObj.combine currentAxis imaginaryAxis
1928+
let updatedAxis = DynObj.combine currentAxis imaginaryAxis |> unbox<ImaginaryAxis>
19291929

19301930
let updatedSmith =
1931-
smith |> Smith.setImaginaryAxis updatedAxis
1931+
smith |> Smith.setImaginaryAxis updatedAxis
19321932

19331933
layout |> Layout.updateSmithById (id, updatedSmith)
19341934

@@ -1982,10 +1982,10 @@ type Chart =
19821982
if combine then
19831983
let currentAxis = smith |> Smith.getRealAxis
19841984

1985-
let updatedAxis = DynObj.combine currentAxis realAxis
1985+
let updatedAxis = DynObj.combine currentAxis realAxis |> unbox<RealAxis>
19861986

19871987
let updatedSmith =
1988-
smith |> Smith.setRealAxis updatedAxis
1988+
smith |> Smith.setRealAxis updatedAxis
19891989

19901990
layout |> Layout.updateSmithById (id, updatedSmith)
19911991

@@ -2364,10 +2364,10 @@ type Chart =
23642364
let currentAxis =
23652365
ternary |> Ternary.getAAxis
23662366

2367-
let updatedAxis = DynObj.combine currentAxis aAxis
2367+
let updatedAxis = DynObj.combine currentAxis aAxis |> unbox<LinearAxis>
23682368

23692369
let updatedTernary =
2370-
ternary |> Ternary.setAAxis updatedAxis
2370+
ternary |> Ternary.setAAxis updatedAxis
23712371

23722372
layout |> Layout.updateTernaryById (id, updatedTernary)
23732373

@@ -2423,7 +2423,7 @@ type Chart =
24232423
let currentAxis =
24242424
ternary |> Ternary.getBAxis
24252425

2426-
let updatedAxis = DynObj.combine currentAxis bAxis
2426+
let updatedAxis = DynObj.combine currentAxis bAxis |> unbox<LinearAxis>
24272427

24282428
let updatedTernary =
24292429
ternary |> Ternary.setBAxis updatedAxis
@@ -2482,7 +2482,7 @@ type Chart =
24822482
let currentAxis =
24832483
ternary |> Ternary.getCAxis
24842484

2485-
let updatedAxis = DynObj.combine currentAxis cAxis
2485+
let updatedAxis = DynObj.combine currentAxis cAxis |> unbox<LinearAxis>
24862486

24872487
let updatedTernary =
24882488
ternary |> Ternary.setCAxis updatedAxis
@@ -3176,8 +3176,9 @@ type Chart =
31763176
calculateSubplotTitlePositions 0. 1. xGap yGap nRows nCols reversed
31773177

31783178
titles
3179-
|> Seq.zip positions[0 .. (Seq.length titles) - 1]
3180-
|> Seq.map (fun (((rowIndex, colIndex), (x, y)), title) ->
3179+
|> Array.ofSeq
3180+
|> Array.zip positions[0 .. (Seq.length titles) - 1]
3181+
|> Array.map (fun (((rowIndex, colIndex), (x, y)), title) ->
31813182
Annotation.init(
31823183
X = x,
31833184
XRef = "paper",
@@ -3199,7 +3200,8 @@ type Chart =
31993200

32003201
gCharts
32013202
|> Seq.zip gridCoordinates
3202-
|> Seq.mapi (fun i ((rowIndex, colIndex), gChart) ->
3203+
|> Array.ofSeq
3204+
|> Array.mapi (fun i ((rowIndex, colIndex), gChart) ->
32033205

32043206
let layout =
32053207
gChart |> GenericChart.getLayout
@@ -3217,35 +3219,36 @@ type Chart =
32173219
let yAxis =
32183220
layout.TryGetTypedPropertyValue<LinearAxis> "yaxis" |> Option.defaultValue (LinearAxis.init ())
32193221

3220-
let allXAxes = Layout.getXAxes layout |> Seq.map fst
3221-
let allYAxes = Layout.getYAxes layout |> Seq.map fst
3222+
let allXAxes = Layout.getXAxes layout |> Array.map fst
3223+
let allYAxes = Layout.getYAxes layout |> Array.map fst
32223224

32233225
// remove all axes from layout. Only cartesian axis in each dimension is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3224-
allXAxes |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3225-
allYAxes |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3226+
allXAxes |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3227+
allYAxes |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
32263228

32273229
let xAnchor, yAnchor =
32283230
if hasSharedAxes then
32293231
colIndex, rowIndex //set axis anchors according to grid coordinates
32303232
else
32313233
i + 1, i + 1
32323234

3233-
gChart
3234-
|> Chart.withAxisAnchor (xAnchor, yAnchor) // set adapted axis anchors
3235-
|> Chart.withXAxis (xAxis, (StyleParam.SubPlotId.XAxis(i + 1))) // set previous axis with adapted id (one individual axis for each subplot, whether or not they will be used later)
3236-
|> Chart.withYAxis (yAxis, (StyleParam.SubPlotId.YAxis(i + 1))) // set previous axis with adapted id (one individual axis for each subplot, whether or not they will be used later)
3237-
3235+
let lol =
3236+
gChart
3237+
|> Chart.withAxisAnchor (xAnchor, yAnchor) // set adapted axis anchors
3238+
|> Chart.withXAxis (xAxis, (StyleParam.SubPlotId.XAxis(i + 1))) // set previous axis with adapted id (one individual axis for each subplot, whether or not they will be used later)
3239+
|> Chart.withYAxis (yAxis, (StyleParam.SubPlotId.YAxis(i + 1))) // set previous axis with adapted id (one individual axis for each subplot, whether or not they will be used later)
3240+
lol
32383241
| TraceID.Cartesian3D ->
32393242

32403243
let scene =
32413244
layout.TryGetTypedPropertyValue<Scene> "scene"
32423245
|> Option.defaultValue (Scene.init ())
32433246
|> Scene.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32443247

3245-
let allScenes = Layout.getScenes layout |> Seq.map fst
3248+
let allScenes = Layout.getScenes layout |> Array.map fst
32463249

32473250
// remove all scenes from layout. Only one scene is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3248-
allScenes |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3251+
allScenes |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
32493252

32503253
let sceneAnchor =
32513254
StyleParam.SubPlotId.Scene(i + 1)
@@ -3260,10 +3263,10 @@ type Chart =
32603263
|> Option.defaultValue (Polar.init ())
32613264
|> Polar.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32623265

3263-
let allPolars = Layout.getPolars layout |> Seq.map fst
3266+
let allPolars = Layout.getPolars layout |> Array.map fst
32643267

32653268
// remove all polar subplots from layout. Only one polar subplot is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3266-
allPolars |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3269+
allPolars |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
32673270

32683271
let polarAnchor =
32693272
StyleParam.SubPlotId.Polar(i + 1)
@@ -3280,10 +3283,10 @@ type Chart =
32803283
|> Option.defaultValue (Smith.init ())
32813284
|> Smith.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32823285

3283-
let allSmiths = Layout.getSmiths layout |> Seq.map fst
3286+
let allSmiths = Layout.getSmiths layout |> Array.map fst
32843287

32853288
// remove all smith subplots from layout. Only one smith subplot is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3286-
allSmiths |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3289+
allSmiths |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
32873290

32883291
let polarAnchor =
32893292
StyleParam.SubPlotId.Smith(i + 1)
@@ -3299,10 +3302,10 @@ type Chart =
32993302
|> Option.defaultValue (Geo.init ())
33003303
|> Geo.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
33013304

3302-
let allGeos = Layout.getGeos layout |> Seq.map fst
3305+
let allGeos = Layout.getGeos layout |> Array.map fst
33033306

33043307
// remove all geo subplots from layout. Only one geo subplot is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3305-
allGeos |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3308+
allGeos |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
33063309

33073310
let geoAnchor =
33083311
StyleParam.SubPlotId.Geo(i + 1)
@@ -3319,10 +3322,10 @@ type Chart =
33193322
Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1)
33203323
)
33213324

3322-
let allMapboxes = Layout.getMapboxes layout |> Seq.map fst
3325+
let allMapboxes = Layout.getMapboxes layout |> Array.map fst
33233326

33243327
// remove all mapbox subplots from layout. Only one mapbox subplot is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3325-
allMapboxes |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3328+
allMapboxes |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
33263329

33273330
let geoAnchor =
33283331
StyleParam.SubPlotId.Geo(i + 1)
@@ -3344,10 +3347,10 @@ type Chart =
33443347
Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1)
33453348
)
33463349

3347-
let allTernaries = Layout.getTernaries layout |> Seq.map fst
3350+
let allTernaries = Layout.getTernaries layout |> Array.map fst
33483351

33493352
// remove all ternary subplots from layout. Only one ternary subplot is supported per grid cell, and leaving anything else on this layout may lead to property name clashes on combine.
3350-
allTernaries |> Seq.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
3353+
allTernaries |> Array.iter (fun propName -> layout.RemoveProperty(propName) |> ignore)
33513354

33523355
let ternaryAnchor =
33533356
StyleParam.SubPlotId.Ternary(i + 1)

src/Plotly.NET/Config/Config.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ type Config() =
334334
(second.TryGetTypedPropertyValue<seq<seq<string>>>("modeBarButtons"))
335335

336336
DynObj.combine first second
337-
|> unbox
337+
|> unbox<Config>
338338
|> Config.style (
339339
?ModeBarButtonsToRemove = (modeBarButtonsToRemove |> Option.map (Seq.map StyleParam.ModeBarButton.ofString)),
340340
?ModeBarButtonsToAdd = (modeBarButtonsToAdd |> Option.map (Seq.map StyleParam.ModeBarButton.ofString)),

src/Plotly.NET/DisplayOptions/DisplayOptions.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type DisplayOptions() =
107107
(second.TryGetTypedPropertyValue<XmlNode list>("ChartDescription"))
108108

109109
DynObj.combine first second
110-
|> unbox
110+
|> unbox<DisplayOptions>
111111
|> DisplayOptions.style (?AdditionalHeadTags = additionalHeadTags, ?ChartDescription = description)
112112

113113
/// <summary>

src/Plotly.NET/Globals.fs

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ let LOGO_BASE64 =
5252
"""iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAA1VBMVEVHcEwQnv+gCXURnf+gCXURnf8Rnf+gCXURnf+gCXWgCXURnf+gCHURnf+gCXURnf+gCXURnf+gCXUwke5YVbykBXEijO+gCXURnf8Rnf8Rnf8Rnf8Rnf8Rnf+gCXWIIoygCXUohekRnf8Rnf8Qn/+gCXUQnf8SoP////8ijO+PG4agAnGQLY6gEnrP7f94yP8aof8YwP/DY6jJcrDuz+RlwP/owt0Urv8k/v4e4v9Nr9F1XaSxMoyx3/9rc7Ayq/98UZ3gr9L8+v05rv9Fv9rF5/+7T52h9OprAAAAJHRSTlMAINTUgPmA+gYGNbu7NR9PR/xP/hoh/o74f471R3x8uie60TS1lKLVAAABzUlEQVRYw83X2XKCMBQGYOyK3RdL9x0ChVCkVAHFfXn/RyphKSIBE85Mp8woV/8HOUByIgj/+mg2yb8o1s4/nZHTw2NNobmzf0HOp/d7Ys18Apzv1hHCvJICqIZA8hnAL0T5FYBXiPOrAJ+Q5HMAj5Dm8wC78JtfA1iFLK8oeYBNWM1vvQitltB4QxxCLn8gXD2/NoTjbXZhLX9ypH8c8giFvKJLiEMo5gnALlDyEcAq0PIxwCZQ8wnAItDzKbBZKObNBJDlMCFvEor5YQ8buDfUJdt3kevb1QLl+j2vb4y9OZZ8z0a251feA238uG8qZh/rkmurSLXdqjrQ62eQn5EWsaqS9Dweh3ewDOI7aHdG5ULJ8yM1WE67cQ0604FaJqx/v0leGc6x8aV94+gpWNqiTR3FrShcU68fHqYSA3J47Qwgwnsm3NxtBtR2NVA2BKcbxIC1mFUOoaSIZldzIuDyU+tkAPtjoAMcLwIV4HkVaQDXx0ABOD9HZxIYwcTRJWswQrOBxT8hpBMKIi+xWmdK4pvS4JMqfFqHLyzwpQ2+uMKXd3iDAW9x4E0WvM2DN5rwVhfebMPbffiGA77lgW+64Ns++MYTvvX9m+MHc8vmMWg2fMUAAAAASUVORK5CYII="""
5353

5454
///
55-
let internal JSON_CONFIG =
55+
let JSON_CONFIG =
5656
JsonSerializerSettings(ReferenceLoopHandling = ReferenceLoopHandling.Serialize)
5757

5858
/// the mathjax v2 tags to add to html docs for rendering latex
59-
let internal MATHJAX_V2_TAGS =
59+
let MATHJAX_V2_TAGS =
6060
[
6161
script
6262
[
@@ -76,7 +76,7 @@ let internal MATHJAX_V2_TAGS =
7676
]
7777

7878
/// the mathjax v3 tags to add to html docs for rendering latex
79-
let internal MATHJAX_V3_TAGS =
79+
let MATHJAX_V3_TAGS =
8080
[
8181
script
8282
[]

0 commit comments

Comments
 (0)