-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add more direct contours styling options to Chart.Contour and Histogram2DContour - Add all these settings to Chart.PointDensity as well to style the contours part of that plot - add tests and adapt existing ones - reflect API changes on Plotly.NET.CSharp (note that these should be re-generated soon)
- Loading branch information
Showing
12 changed files
with
450 additions
and
226 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
96 changes: 96 additions & 0 deletions
96
tests/Common/FSharpTestBase/TestCharts/FeatureAdditions/Accessible_Contours.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,96 @@ | ||
module Accessible_Contrours_TestCharts | ||
|
||
open Plotly.NET | ||
open Plotly.NET.TraceObjects | ||
open Plotly.NET.LayoutObjects | ||
|
||
// https://github.com/plotly/Plotly.NET/issues/426 | ||
|
||
module ``Contours should be accessible #426`` = | ||
|
||
let ``Contour chart with more contours settings`` = | ||
// max z is 10 | ||
Chart.Contour( | ||
zData = [ | ||
[5;2;3] | ||
[10;2;1] | ||
[0;5;1] | ||
], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
|
||
|
||
let ``Histogram2DContour chart with more contours settings`` = | ||
// max z is 5 | ||
Chart.Histogram2DContour( | ||
X = [1;1;2;2;2;2;2;3;4;5], | ||
Y = [1;1;2;2;2;2;2;3;4;5], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
|
||
|
||
let ``PointDensity chart with accessible contours settings`` = | ||
// max z is 15 | ||
Chart.PointDensity( | ||
x = [1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;4;5], | ||
y = [1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;4;5], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
|
||
let ``Contours trace Grid chart with shared color axis and adapted contours ranges`` = | ||
[ | ||
// max z is 10 | ||
Chart.Contour( | ||
zData = [ | ||
[5;2;3] | ||
[10;2;1] | ||
[0;5;1] | ||
], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
|
||
// max z is 5 | ||
Chart.Histogram2DContour( | ||
X = [1;1;2;2;2;2;2;3;4;5], | ||
Y = [1;1;2;2;2;2;2;3;4;5], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
|
||
// max z is 15 | ||
Chart.PointDensity( | ||
x = [1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;4;5], | ||
y = [1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;4;5], | ||
ShowContoursLabels = true, | ||
ShowContourLines = true, | ||
ContoursStart = 0, | ||
ContoursEnd = 15, | ||
UseDefaults = false | ||
) | ||
|> Chart.withColorAxisAnchor(1) | ||
] | ||
|> Chart.Grid(2,2) |
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
47 changes: 47 additions & 0 deletions
47
tests/CoreTests/CoreTests/FeatureAdditions/Accessible_Contours.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,47 @@ | ||
// https://github.com/plotly/Plotly.NET/issues/426 | ||
|
||
module CoreTests.Accessible_Contours | ||
|
||
open Expecto | ||
open Plotly.NET | ||
open Plotly.NET.LayoutObjects | ||
open Plotly.NET.TraceObjects | ||
|
||
open TestUtils.HtmlCodegen | ||
open Accessible_Contrours_TestCharts | ||
|
||
module ``Contours should be accessible #426`` = | ||
|
||
[<Tests>] | ||
let ``Contours should be accessible #426`` = | ||
testList "FeatureAddition.Contours should be accessible" [ | ||
test "more contours settings on Contour data" { | ||
"""var data = [{"type":"contour","z":[[5,2,3],[10,2,1],[0,5,1]],"line":{"width":0.0},"contours":{"end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis"}];""" | ||
|> chartGeneratedContains ``Contours should be accessible #426``.``Contour chart with more contours settings`` | ||
} | ||
test "more contours settings on Contour layout" { | ||
emptyLayout ``Contours should be accessible #426``.``Contour chart with more contours settings`` | ||
} | ||
test "more contours settings on Histogram2DContour data" { | ||
"""var data = [{"type":"histogram2dcontour","x":[1,1,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,3,4,5],"line":{"width":0.0},"contours":{"end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis"}];""" | ||
|> chartGeneratedContains ``Contours should be accessible #426``.``Histogram2DContour chart with more contours settings`` | ||
} | ||
test "more contours settings on Histogram2DContour layout" { | ||
emptyLayout ``Contours should be accessible #426``.``Histogram2DContour chart with more contours settings`` | ||
} | ||
test "Accessible contours settings on PointDensity data" { | ||
"""var data = [{"type":"histogram2dcontour","x":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"line":{"width":0.0},"contours":{"coloring":"fill","end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis"},{"type":"scatter","opacity":0.3,"mode":"markers","x":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"marker":{},"coloraxis":"coloraxis"}];""" | ||
|> chartGeneratedContains ``Contours should be accessible #426``.``PointDensity chart with accessible contours settings`` | ||
} | ||
test "Accessible contours settings on PointDensity layout" { | ||
emptyLayout ``Contours should be accessible #426``.``PointDensity chart with accessible contours settings`` | ||
} | ||
test "Chart Grid with shared color axis and corrected contours ranges data" { | ||
"""var data = [{"type":"contour","z":[[5,2,3],[10,2,1],[0,5,1]],"line":{"width":0.0},"contours":{"end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis","xaxis":"x","yaxis":"y"},{"type":"histogram2dcontour","x":[1,1,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,3,4,5],"line":{"width":0.0},"contours":{"end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis","xaxis":"x2","yaxis":"y2"},{"type":"histogram2dcontour","x":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"line":{"width":0.0},"contours":{"coloring":"fill","end":15.0,"showlabels":true,"start":0.0},"coloraxis":"coloraxis","xaxis":"x3","yaxis":"y3"},{"type":"scatter","opacity":0.3,"mode":"markers","x":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"y":[1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5],"marker":{},"coloraxis":"coloraxis","xaxis":"x3","yaxis":"y3"}];""" | ||
|> chartGeneratedContains ``Contours should be accessible #426``.``Contours trace Grid chart with shared color axis and adapted contours ranges`` | ||
} | ||
test "Chart Grid with shared color axis and corrected contours ranges layout" { | ||
"""var layout = {"xaxis":{},"yaxis":{},"xaxis2":{},"yaxis2":{},"xaxis3":{},"yaxis3":{},"grid":{"rows":2,"columns":2,"pattern":"independent"}};""" | ||
|> chartGeneratedContains ``Contours should be accessible #426``.``Contours trace Grid chart with shared color axis and adapted contours ranges`` | ||
} | ||
] |
Oops, something went wrong.