-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plotly.js v2.23: add
xref
and yref
attributes for Legend and Colo…
…rBar - add tests - add attributes to Chart API functions `withLegendStyle` and `withColorBarStyle`
- Loading branch information
Showing
15 changed files
with
261 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.23.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module PlotlyJS_2_23_TestCharts | ||
|
||
open Plotly.NET | ||
open Plotly.NET.TraceObjects | ||
open Plotly.NET.LayoutObjects | ||
|
||
|
||
module ``Colorbar X and Y ref`` = | ||
|
||
let ``Heatmap with horizontal colorbar with x/yref = container`` = | ||
Chart.Heatmap( | ||
[ | ||
[1; 2; 3] | ||
[3; 2; 1] | ||
], | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorBar( | ||
ColorBar.init( | ||
X = 0.5, | ||
Y = 0.1, | ||
Orientation = StyleParam.Orientation.Horizontal, | ||
XRef = "container", | ||
YRef = "container", | ||
Title = Title.init( | ||
Text = "Colorbar 1" | ||
) | ||
) | ||
) | ||
|
||
module ``Legend X and Y ref`` = | ||
|
||
let ``Point chart with horizontal legend with x/yref = container`` = | ||
Chart.Point( | ||
[1,2], | ||
ShowLegend = true, | ||
UseDefaults = false | ||
) | ||
|> Chart.withLegend( | ||
Legend.init( | ||
X = 0.5, | ||
Y = 0.1, | ||
Orientation = StyleParam.Orientation.Horizontal, | ||
XRef = "container", | ||
YRef = "container", | ||
BorderColor = Color.fromKeyword Blue, | ||
BorderWidth = 2, | ||
Title = Title.init( | ||
Text = "Legend 1" | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module CoreTests.UpstreamFeatures.PlotlyJS_2_23 | ||
|
||
open Expecto | ||
open Plotly.NET | ||
open Plotly.NET.LayoutObjects | ||
open Plotly.NET.TraceObjects | ||
|
||
|
||
open TestUtils.HtmlCodegen | ||
open PlotlyJS_2_23_TestCharts | ||
|
||
module ``Colorbar X and Y ref`` = | ||
|
||
[<Tests>] | ||
let ``Colorbar X/YRef HTML codegeneration tests`` = | ||
testList "UpstreamFeatures.PlotlyJS_2_23" [ | ||
testList "Colorbar X/YRef" [ | ||
testCase "Heatmap with horizontal colorbar with x/yref = container data" ( fun () -> | ||
"""var data = [{"type":"heatmap","z":[[1,2,3],[3,2,1]],"colorbar":{"orientation":"h","title":{"text":"Colorbar 1"},"x":0.5,"xref":"container","y":0.1,"yref":"container"}}];""" | ||
|> chartGeneratedContains ``Colorbar X and Y ref``.``Heatmap with horizontal colorbar with x/yref = container`` | ||
) | ||
testCase "Heatmap with horizontal colorbar with x/yref = container layout" ( fun () -> | ||
emptyLayout ``Colorbar X and Y ref``.``Heatmap with horizontal colorbar with x/yref = container`` | ||
) | ||
] | ||
] | ||
|
||
module ``Legend X and Y ref`` = | ||
|
||
[<Tests>] | ||
let ``Legend X/YRef HTML codegeneration tests`` = | ||
testList "UpstreamFeatures.PlotlyJS_2_23" [ | ||
testList "Legend X/YRef" [ | ||
testCase "Point chart with horizontal legend with x/yref = container data" ( fun () -> | ||
"""var data = [{"type":"scatter","showlegend":true,"mode":"markers","x":[1],"y":[2],"marker":{},"line":{}}];""" | ||
|> chartGeneratedContains ``Legend X and Y ref``.``Point chart with horizontal legend with x/yref = container`` | ||
) | ||
testCase "Point chart with horizontal legend with x/yref = container layout" ( fun () -> | ||
"""var layout = {"legend":{"bordercolor":"rgba(0, 0, 255, 1.0)","borderwidth":2.0,"orientation":"h","title":{"text":"Legend 1"},"x":0.5,"xref":"container","y":0.1,"yref":"container"}};""" | ||
|> chartGeneratedContains ``Legend X and Y ref``.``Point chart with horizontal legend with x/yref = container`` | ||
) | ||
] | ||
] |