-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plotlyjs 2.27: Add insiderange to cartesian axes
- Loading branch information
Showing
7 changed files
with
127 additions
and
7 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
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
48 changes: 48 additions & 0 deletions
48
tests/Common/FSharpTestBase/TestCharts/UpstreamFeatures/2.27.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,48 @@ | ||
module PlotlyJS_2_27_TestCharts | ||
|
||
open Plotly.NET | ||
open Plotly.NET.TraceObjects | ||
open Plotly.NET.LayoutObjects | ||
|
||
|
||
module ``InsideRange for linear axes`` = | ||
|
||
let ``Inside range for y axis`` = | ||
Chart.Line( | ||
x = [1; 2; 3; 4], | ||
y = [1; 1; 2; 3], | ||
UseDefaults = false | ||
) | ||
|> Chart.withXAxis( | ||
LinearAxis.init( | ||
Anchor = StyleParam.LinearAxisId.Y 1, | ||
Ticks = StyleParam.TickOptions.Inside, | ||
TickLabelPosition = StyleParam.TickLabelPosition.Inside | ||
) | ||
) | ||
|> Chart.withYAxis( | ||
LinearAxis.init( | ||
Anchor = StyleParam.LinearAxisId.X 1, | ||
InsideRange = StyleParam.Range.ofMinMax(1, 3) | ||
) | ||
) | ||
|
||
let ``Inside range for x axis`` = | ||
Chart.Line( | ||
x = [1; 2; 3; 4], | ||
y = [1; 1; 2; 3], | ||
UseDefaults = false | ||
) | ||
|> Chart.withXAxis( | ||
LinearAxis.init( | ||
Anchor = StyleParam.LinearAxisId.Y 1, | ||
InsideRange = StyleParam.Range.ofMinMax(1, 3) | ||
) | ||
) | ||
|> Chart.withYAxis( | ||
LinearAxis.init( | ||
Anchor = StyleParam.LinearAxisId.X 1, | ||
Ticks = StyleParam.TickOptions.Inside, | ||
TickLabelPosition = StyleParam.TickLabelPosition.Inside | ||
) | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module CoreTests.UpstreamFeatures.PlotlyJS_2_27 | ||
|
||
open Expecto | ||
open Plotly.NET | ||
open Plotly.NET.LayoutObjects | ||
open Plotly.NET.TraceObjects | ||
|
||
open TestUtils.HtmlCodegen | ||
open PlotlyJS_2_27_TestCharts | ||
|
||
module ``InsideRange for linear axes`` = | ||
[<Tests>] | ||
let ``InsideRange for linear axes tests`` = | ||
testList "UpstreamFeatures.PlotlyJS_2_27" [ | ||
testList "InsideRange for linear axes" [ | ||
testCase "Inside range for x axis data" ( fun () -> | ||
"""var data = [{"type":"scatter","mode":"lines","x":[1,2,3,4],"y":[1,1,2,3],"marker":{},"line":{}}];""" | ||
|> chartGeneratedContains ``InsideRange for linear axes``.``Inside range for x axis`` | ||
) | ||
testCase "Inside range for x axis layout" ( fun () -> | ||
"""var layout = {"xaxis":{"insiderange":[1,3],"anchor":"y"},"yaxis":{"ticks":"inside","ticklabelposition":"inside","anchor":"x"}};""" | ||
|> chartGeneratedContains ``InsideRange for linear axes``.``Inside range for x axis`` | ||
) | ||
testCase "Inside range for y axis data" ( fun () -> | ||
"""var data = [{"type":"scatter","mode":"lines","x":[1,2,3,4],"y":[1,1,2,3],"marker":{},"line":{}}];""" | ||
|> chartGeneratedContains ``InsideRange for linear axes``.``Inside range for y axis`` | ||
) | ||
testCase "Inside range for y axis layout" ( fun () -> | ||
"""var layout = {"xaxis":{"ticks":"inside","ticklabelposition":"inside","anchor":"y"},"yaxis":{"insiderange":[1,3],"anchor":"x"}};""" | ||
|> chartGeneratedContains ``InsideRange for linear axes``.``Inside range for y axis`` | ||
) | ||
] | ||
] |