Skip to content

Commit 2debc2a

Browse files
committed
Do not use defaults for any layout tests
1 parent 67f6720 commit 2debc2a

File tree

12 files changed

+164
-133
lines changed

12 files changed

+164
-133
lines changed

tests/Plotly.NET.Tests/HtmlCodegen/CarpetCharts.fs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ let y = [2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.]
1515

1616
let carpets =
1717
[
18-
Chart.Carpet("carpet1",A = a, B = b, Y = y)
19-
Chart.Carpet("carpet2",A = (a |> List.rev) , B = (b |> List.rev), Y = (y |> List.map (fun x -> x + 10.)))
20-
Chart.Carpet("carpet3",A = a, B = b, Y = (y |> List.map (fun x -> x + 20.)))
21-
Chart.Carpet("carpet4",A = (a |> List.rev) , B = (b |> List.rev), Y = (y |> List.map (fun x -> x + 30.)))
22-
Chart.Carpet("carpet5",A = a, B = b, Y = (y |> List.map (fun x -> x + 40.)))
18+
Chart.Carpet("carpet1",A = a, B = b, Y = y, UseDefaults = false)
19+
Chart.Carpet("carpet2",A = (a |> List.rev) , B = (b |> List.rev), Y = (y |> List.map (fun x -> x + 10.)), UseDefaults = false)
20+
Chart.Carpet("carpet3",A = a, B = b, Y = (y |> List.map (fun x -> x + 20.)), UseDefaults = false)
21+
Chart.Carpet("carpet4",A = (a |> List.rev) , B = (b |> List.rev), Y = (y |> List.map (fun x -> x + 30.)), UseDefaults = false)
22+
Chart.Carpet("carpet5",A = a, B = b, Y = (y |> List.map (fun x -> x + 40.)), UseDefaults = false)
2323
]
2424

2525
let aData = [4.; 5.; 5.; 6.]
@@ -41,12 +41,13 @@ let carpetCharts =
4141
StyleParam.MarkerSymbol.Hexagon2
4242
],
4343
MultiSize = sizes,
44-
Color = Color.fromColors ([Red; Blue; Green; Yellow] |> List.map Color.fromKeyword)
44+
Color = Color.fromColors ([Red; Blue; Green; Yellow] |> List.map Color.fromKeyword),
45+
UseDefaults = false
4546
)
46-
Chart.PointCarpet(aData,bData,"carpet2",Name = "Point")
47-
Chart.LineCarpet(aData,bData,"carpet3",Name = "Line")
48-
Chart.SplineCarpet(aData,bData,"carpet4",Name = "Spline")
49-
Chart.BubbleCarpet((Seq.zip3 aData bData sizes),"carpet5",Name = "Bubble")
47+
Chart.PointCarpet(aData,bData,"carpet2",Name = "Point", UseDefaults = false)
48+
Chart.LineCarpet(aData,bData,"carpet3",Name = "Line", UseDefaults = false)
49+
Chart.SplineCarpet(aData,bData,"carpet4",Name = "Spline", UseDefaults = false)
50+
Chart.BubbleCarpet((Seq.zip3 aData bData sizes),"carpet5",Name = "Bubble", UseDefaults = false)
5051
]
5152

5253
let scatter = Chart.combine [carpets.[0]; carpetCharts.[0]]
@@ -117,13 +118,15 @@ let contour =
117118
Smoothing = 0.,
118119
MinorGridCount = 9,
119120
AxisType = StyleParam.AxisType.Linear
120-
)
121+
),
122+
UseDefaults = false
121123
)
122124
Chart.ContourCarpet(
123125
"contour",
124126
[1.; 1.96; 2.56; 3.0625; 4.; 5.0625; 1.; 7.5625; 9.; 12.25; 15.21; 14.0625],
125127
A = [0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3],
126-
B = [4; 4; 4; 4; 5; 5; 5; 5; 6; 6; 6; 6]
128+
B = [4; 4; 4; 4; 5; 5; 5; 5; 6; 6; 6; 6],
129+
UseDefaults = false
127130
)
128131
]
129132
|> Chart.combine

tests/Plotly.NET.Tests/HtmlCodegen/CategoricalCharts.fs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ let parallelCategoriesChart =
1919
Chart.ParallelCategories(
2020
dims,
2121
Color=Color.fromColorScaleValues [0.;1.;0.;1.;0.;0.;0.],
22-
Colorscale = StyleParam.Colorscale.Blackbody
22+
Colorscale = StyleParam.Colorscale.Blackbody,
23+
UseDefaults = false
2324
)
2425

2526
[<Tests>]
@@ -43,7 +44,7 @@ let parcoords1Chart =
4344
"C",[2.;4.;3.1;5.]
4445
"D",[4.;2.;2.;4.;]
4546
]
46-
Chart.ParallelCoord(data,Color=Color.fromString "blue")
47+
Chart.ParallelCoord(data,Color=Color.fromString "blue", UseDefaults = false)
4748

4849
let parcoordsChart =
4950
let v = [|
@@ -64,7 +65,7 @@ let parcoordsChart =
6465
dyn?line <- Line.init(Color =Color.fromString "blue")
6566

6667
dyn
67-
|> GenericChart.ofTraceObject true
68+
|> GenericChart.ofTraceObject false
6869

6970
[<Tests>]
7071
let ``Parallel coordinates charts`` =
@@ -102,7 +103,8 @@ let sankey1 =
102103
let link5 = Link.Create(n3,n5,value=0.5)
103104
Chart.Sankey(
104105
[n1;n2;n3;n4;n5],
105-
[link1;link2;link3;link4;link5]
106+
[link1;link2;link3;link4;link5],
107+
UseDefaults = false
106108
)
107109
|> Chart.withTitle "Sankey Sample"
108110

@@ -130,7 +132,8 @@ let icicleChart =
130132
ColorScale = StyleParam.Colorscale.Viridis,
131133
TilingOrientation = StyleParam.Orientation.Vertical,
132134
TilingFlip = StyleParam.TilingFlip.Y,
133-
PathBarEdgeShape = StyleParam.PathbarEdgeShape.BackSlash
135+
PathBarEdgeShape = StyleParam.PathbarEdgeShape.BackSlash,
136+
UseDefaults = false
134137
)
135138

136139
[<Tests>]

tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let axisStylingChart =
1212
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
1313
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
1414
let plot1 =
15-
Chart.Point(x,y)
15+
Chart.Point(x,y, UseDefaults = false)
1616
|> Chart.withXAxisStyle ("X axis title quack quack", MinMax = (-1.,10.))
1717
|> Chart.withYAxisStyle ("Y axis title boo foo", MinMax = (-1.,10.))
1818
plot1
@@ -42,11 +42,11 @@ let multipleAxesChart =
4242
let y' = y |> List.map (fun y -> y * 2.) |> List.rev
4343

4444
let anchoredAt1 =
45-
Chart.Line (x,y,Name="anchor 1")
45+
Chart.Line (x,y,Name="anchor 1", UseDefaults = false)
4646
|> Chart.withAxisAnchor(Y=1)
4747

4848
let anchoredAt2 =
49-
Chart.Line (x,y',Name="anchor 2")
49+
Chart.Line (x,y',Name="anchor 2", UseDefaults = false)
5050
|> Chart.withAxisAnchor(Y=2)
5151

5252
let twoYAxes1 =
@@ -83,7 +83,7 @@ let errorBarsChart =
8383
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
8484
let xError = [|0.2;0.3;0.2;0.1;0.2;0.4;0.2;0.08;0.2;0.1;|]
8585
let yError = [|0.3;0.2;0.1;0.4;0.2;0.4;0.1;0.18;0.02;0.2;|]
86-
Chart.Point(x,y',Name="points with errors")
86+
Chart.Point(x,y',Name="points with errors", UseDefaults = false)
8787
|> Chart.withXErrorStyle (Array=xError,Symmetric=true)
8888
|> Chart.withYErrorStyle (Array=yError, Arrayminus = xError)
8989

@@ -114,25 +114,25 @@ let combinedChart =
114114
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
115115
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
116116
[
117-
Chart.Line(x, y, Name="first")
118-
Chart.Line(y, x, Name="second")
117+
Chart.Line(x, y, Name="first", UseDefaults = false)
118+
Chart.Line(y, x, Name="second", UseDefaults = false)
119119
]
120120
|> Chart.combine
121121

122122
let subPlotChart =
123123
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
124124
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
125125
[
126-
Chart.Point(x, y, Name="1,1")
126+
Chart.Point(x, y, Name="1,1", UseDefaults = false)
127127
|> Chart.withXAxisStyle "x1"
128128
|> Chart.withYAxisStyle "y1"
129-
Chart.Line(x, y, Name="1,2")
129+
Chart.Line(x, y, Name="1,2", UseDefaults = false)
130130
|> Chart.withXAxisStyle "x2"
131131
|> Chart.withYAxisStyle "y2"
132-
Chart.Spline(x, y, Name="2,1")
132+
Chart.Spline(x, y, Name="2,1", UseDefaults = false)
133133
|> Chart.withXAxisStyle "x3"
134134
|> Chart.withYAxisStyle "y3"
135-
Chart.Point(x, y, Name="2,2")
135+
Chart.Point(x, y, Name="2,2", UseDefaults = false)
136136
|> Chart.withXAxisStyle "x4"
137137
|> Chart.withYAxisStyle "y4"
138138
]
@@ -143,13 +143,13 @@ let singleStackChart =
143143
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
144144
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
145145
[
146-
Chart.Point(x,y)
146+
Chart.Point(x,y, UseDefaults = false)
147147
|> Chart.withYAxisStyle("This title must")
148148

149-
Chart.Line(x,y)
149+
Chart.Line(x,y, UseDefaults = false)
150150
|> Chart.withYAxisStyle("be set on the",ZeroLine=false)
151151

152-
Chart.Spline(x,y)
152+
Chart.Spline(x,y, UseDefaults = false)
153153
|> Chart.withYAxisStyle("respective subplots",ZeroLine=false)
154154
]
155155
|> Chart.SingleStack(Pattern = StyleParam.LayoutGridPattern.Coupled)
@@ -160,16 +160,16 @@ let singleStackChart =
160160

161161
let multiTraceGrid =
162162
[
163-
Chart.Point([1,2; 2,3])
164-
Chart.PointTernary([1,2,3; 2,3,4])
165-
Chart.Heatmap([[1; 2];[3; 4]], Showscale=false)
166-
Chart.Point3d([1,3,2])
167-
Chart.PointMapbox([1,2]) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap))
163+
Chart.Point([1,2; 2,3], UseDefaults = false)
164+
Chart.PointTernary([1,2,3; 2,3,4], UseDefaults = false)
165+
Chart.Heatmap([[1; 2];[3; 4]], Showscale=false, UseDefaults = false)
166+
Chart.Point3d([1,3,2], UseDefaults = false)
167+
Chart.PointMapbox([1,2], UseDefaults = false) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap))
168168
[
169169
// you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case)
170170
let y = [2.; 1.5; 5.; 1.5; 2.; 2.5; 2.1; 2.5; 1.5; 1.;2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
171-
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All);
172-
Chart.BoxPlot("y'",y,Name="bin2",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All);
171+
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
172+
Chart.BoxPlot("y'",y,Name="bin2",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
173173
]
174174
|> Chart.combine
175175
]
@@ -179,16 +179,16 @@ let multiTraceGrid =
179179

180180
let multiTraceSingleStack =
181181
[
182-
Chart.Point([1,2; 2,3])
183-
Chart.PointTernary([1,2,3; 2,3,4])
184-
Chart.Heatmap([[1; 2];[3; 4]], Showscale=false)
185-
Chart.Point3d([1,3,2])
186-
Chart.PointMapbox([1,2]) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap))
182+
Chart.Point([1,2; 2,3], UseDefaults = false)
183+
Chart.PointTernary([1,2,3; 2,3,4], UseDefaults = false)
184+
Chart.Heatmap([[1; 2];[3; 4]], Showscale=false, UseDefaults = false)
185+
Chart.Point3d([1,3,2], UseDefaults = false)
186+
Chart.PointMapbox([1,2], UseDefaults = false) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap))
187187
[
188188
// you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case)
189189
let y = [2.; 1.5; 5.; 1.5; 2.; 2.5; 2.1; 2.5; 1.5; 1.;2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
190-
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All);
191-
Chart.BoxPlot("y'",y,Name="bin2",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All);
190+
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
191+
Chart.BoxPlot("y'",y,Name="bin2",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
192192
]
193193
|> Chart.combine
194194
]
@@ -243,7 +243,7 @@ let shapesChart =
243243
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
244244
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor=Color.fromHex "#d3d3d3")
245245
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor=Color.fromHex "#d3d3d3")
246-
Chart.Line(x,y',Name="line")
246+
Chart.Line(x,y',Name="line", UseDefaults = false)
247247
|> Chart.withShapes([s1;s2])
248248

249249

@@ -264,7 +264,7 @@ let displayOptionsChartDescriptionChart =
264264
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
265265
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
266266
let description1 = ChartDescription.create "Hello" "F#"
267-
Chart.Point(x,y,Name="desc1")
267+
Chart.Point(x,y,Name="desc1", UseDefaults = false)
268268
|> Chart.withDescription(description1)
269269

270270
let additionalHeadTagsChart =
@@ -287,15 +287,15 @@ let additionalHeadTagsChart =
287287
ChartDescription.create
288288
"""<h1 class="title">I am heading</h1>"""
289289
bulmaHero
290-
Chart.Point(x,y,Name="desc3")
290+
Chart.Point(x,y,Name="desc3", UseDefaults = false)
291291
|> Chart.withDescription description3
292292
// Add reference to the bulma css framework
293293
|> Chart.withAdditionalHeadTags ["""<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.2/css/bulma.min.css">"""]
294294

295295
let mathtexChart =
296296
[
297-
Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
298-
Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
297+
Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$", UseDefaults = false)
298+
Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$", UseDefaults = false)
299299
]
300300
|> Chart.combine
301301
|> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$"

tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let scatterChart =
3232
let y = [19; 26; 55;]
3333
let z = [19; 26; 55;]
3434

35-
Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers)
35+
Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers, UseDefaults = false)
3636
|> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1)
3737
|> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1)
3838
|> Chart.withZAxisStyle("my z-axis")
@@ -56,7 +56,7 @@ let pointChart =
5656
let y = [19; 26; 55;]
5757
let z = [19; 26; 55;]
5858

59-
Chart.Point3d(x,y,z)
59+
Chart.Point3d(x,y,z, UseDefaults = false)
6060
|> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1)
6161
|> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1)
6262
|> Chart.withZAxisStyle("my z-axis")
@@ -91,7 +91,7 @@ let lineChart =
9191
)
9292
|> List.unzip3
9393

94-
Chart.Line3d(x, y, z, ShowMarkers=true)
94+
Chart.Line3d(x, y, z, ShowMarkers=true, UseDefaults = false)
9595
|> Chart.withXAxisStyle("x-axis", Id=StyleParam.SubPlotId.Scene 1)
9696
|> Chart.withYAxisStyle("y-axis", Id=StyleParam.SubPlotId.Scene 1)
9797
|> Chart.withZAxisStyle("z-axis")
@@ -115,7 +115,8 @@ let bubbleChart =
115115
[1,3,2; 6,5,4; 7,9,8],
116116
[20; 40; 30],
117117
Labels = ["A"; "B"; "C"],
118-
TextPosition = StyleParam.TextPosition.TopLeft
118+
TextPosition = StyleParam.TextPosition.TopLeft,
119+
UseDefaults = false
119120
)
120121
|> Chart.withXAxisStyle("x-axis", Id=StyleParam.SubPlotId.Scene 1)
121122
|> Chart.withYAxisStyle("y-axis", Id=StyleParam.SubPlotId.Scene 1)
@@ -149,8 +150,7 @@ let firstSurfaceChart =
149150
Array.init size (fun j -> f x.[j] y.[i] )
150151
)
151152

152-
z
153-
|> Chart.Surface
153+
Chart.Surface(z, UseDefaults = false)
154154

155155

156156
let secondSurfaceChart =
@@ -161,7 +161,7 @@ let secondSurfaceChart =
161161
[1.;2.;];
162162
] // column (length y)
163163

164-
Chart.Surface(z', x', y', Opacity=0.5, Contours=Contours.initXyz(Show=true))
164+
Chart.Surface(z', x', y', Opacity=0.5, Contours=Contours.initXyz(Show=true), UseDefaults = false)
165165

166166
[<Tests>]
167167
let ``Surface charts`` =
@@ -218,7 +218,7 @@ let meshChart =
218218
mesh3d?contour <- Contours.initXyz(Show=true)
219219
mesh3d
220220
)
221-
|> GenericChart.ofTraceObject true
221+
|> GenericChart.ofTraceObject false
222222

223223
[<Tests>]
224224
let ``Mesh charts`` =
@@ -240,7 +240,8 @@ let coneChart =
240240
u = [1; 2; 3],
241241
v = [1; 1; 2],
242242
w = [4; 4; 1],
243-
ColorScale = StyleParam.Colorscale.Viridis
243+
ColorScale = StyleParam.Colorscale.Viridis,
244+
UseDefaults = false
244245
)
245246

246247
[<Tests>]
@@ -263,7 +264,8 @@ let streamTubeChart =
263264
u = [0; 0; 0],
264265
v = [1; 1; 1],
265266
w = [0; 0; 0],
266-
ColorScale = StyleParam.Colorscale.Viridis
267+
ColorScale = StyleParam.Colorscale.Viridis,
268+
UseDefaults = false
267269
)
268270

269271
[<Tests>]
@@ -285,7 +287,8 @@ let volumeChart =
285287
y |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
286288
z |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
287289
z |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
288-
ColorScale = StyleParam.Colorscale.Viridis
290+
ColorScale = StyleParam.Colorscale.Viridis,
291+
UseDefaults = false
289292
)
290293

291294
[<Tests>]
@@ -307,7 +310,8 @@ let isoSurfaceChart =
307310
y |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
308311
z |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
309312
z |> Array.concat |> Array.concat |> Array.map (fun x -> Math.Round(x,3)),
310-
ColorScale = StyleParam.Colorscale.Viridis
313+
ColorScale = StyleParam.Colorscale.Viridis,
314+
UseDefaults = false
311315
)
312316

313317
[<Tests>]

0 commit comments

Comments
 (0)