Skip to content

Commit f75125e

Browse files
committed
plotly.js v2.24: add pattern to multiple traces
- Add Marker pattern for `Chart.Pie`, `Chart.Doughnut`, `Chart.FunnelArea, `Chart.Sunburst, `Chart.Icicle and `Chart.Treemap - Add some xml docs for the `Pattern` object
1 parent a3e1abc commit f75125e

File tree

16 files changed

+407
-74
lines changed

16 files changed

+407
-74
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Build and test](https://github.com/plotly/Plotly.NET/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/plotly/Plotly.NET/actions/workflows/build-and-test.yml)
55
[![](https://img.shields.io/nuget/vpre/Plotly.NET)](https://www.nuget.org/packages/Plotly.NET/)
66
[![Discord](https://img.shields.io/discord/836161044501889064?color=purple&label=Join%20our%20Discord%21&logo=discord&logoColor=white)](https://discord.gg/k3kUtFY8DB)
7-
![](https://img.shields.io/badge/supported%20plotly.js%20version-2.23.2-blue)
7+
![](https://img.shields.io/badge/supported%20plotly.js%20version-2.24.3-blue)
88
[![DOI](https://img.shields.io/badge/DOI-10.12688%2Ff1000research.123971.1-brightgreen)](https://doi.org/10.12688/f1000research.123971.1)
99

1010
### Table of contents

src/Plotly.NET/ChartAPI/ChartDomain.fs

+138-17
Large diffs are not rendered by default.

src/Plotly.NET/Globals.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open Giraffe.ViewEngine
77

88
/// The plotly js version loaded from cdn in rendered html docs
99
[<Literal>]
10-
let PLOTLYJS_VERSION = "2.23.2"
10+
let PLOTLYJS_VERSION = "2.24.3"
1111

1212
[<Literal>]
1313
let SCRIPT_TEMPLATE =

src/Plotly.NET/Plotly.NET.fsproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<ItemGroup>
4141
<None Include="RELEASE_NOTES.md" />
4242
<None Include="..\..\docs\img\logo.png" Pack="true" PackagePath="\" />
43-
<EmbeddedResource Include="plotly-2.23.2.min.js" />
44-
<EmbeddedResource Include="plotly-2.23.2.min.js.LICENSE.txt" />
43+
<EmbeddedResource Include="plotly-2.24.3.min.js" />
44+
<EmbeddedResource Include="plotly-2.24.3.min.js.LICENSE.txt" />
4545
<Compile Include="Globals.fs" />
4646
<Compile Include="InternalUtils.fs" />
4747
<Compile Include="CommonAbstractions\ColorKeyword.fs" />

src/Plotly.NET/RELEASE_NOTES.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- Keep up with plotlyjs 2.x incremental updates:
66
- v2.22:
77
- [Implement multi legend support](https://github.com/plotly/Plotly.NET/issues/406)
8+
- v2.23:
9+
- [add `xref` and `yref` attributes for Legend and ColorBar](https://github.com/plotly/Plotly.NET/commit/a3e1abcfda7b316c704d477471be1294860b48b7)
810

911
### 4.2.0 - August 02 2023
1012

src/Plotly.NET/Traces/ObjectAbstractions/Pattern.fs

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Pattern() =
1010
inherit DynamicObj()
1111

1212
/// <summary>
13-
///
13+
/// Returns a new Pattern object with the given styles
1414
/// </summary>
1515
/// <param name="BGColor">When there is no colorscale sets the color of background pattern fill. Defaults to a `marker.color` background when `fillmode` is "overlay". Otherwise, defaults to a transparent background. </param>
1616
/// <param name="FGColor">When there is no colorscale sets the color of foreground pattern fill. Defaults to a `marker.color` background when `fillmode` is "replace". Otherwise, defaults to dark grey or white to increase contrast with the `bgcolor`.</param>
@@ -46,6 +46,18 @@ type Pattern() =
4646
?Solidity = Solidity
4747
)
4848

49+
/// <summary>
50+
/// Returns a function that applies the given styles to a Pattern object
51+
/// </summary>
52+
/// <param name="BGColor">When there is no colorscale sets the color of background pattern fill. Defaults to a `marker.color` background when `fillmode` is "overlay". Otherwise, defaults to a transparent background. </param>
53+
/// <param name="FGColor">When there is no colorscale sets the color of foreground pattern fill. Defaults to a `marker.color` background when `fillmode` is "replace". Otherwise, defaults to dark grey or white to increase contrast with the `bgcolor`.</param>
54+
/// <param name="FGOpacity">Sets the opacity of the foreground pattern fill. Defaults to a 0.5 when `fillmode` is "overlay". Otherwise, defaults to 1.</param>
55+
/// <param name="FillMode">Determines whether `marker.color` should be used as a default to `bgcolor` or a `fgcolor`.</param>
56+
/// <param name="Shape">Sets the shape of the pattern fill. By default, no pattern is used for filling the area.</param>
57+
/// <param name="MultiShape">Sets the shape of the pattern fill. By default, no pattern is used for filling the area.</param>
58+
/// <param name="Size">Sets the size of unit squares of the pattern fill in pixels, which corresponds to the interval of repetition of the pattern.</param>
59+
/// <param name="MultiSize">Sets the size of unit squares of the pattern fill in pixels, which corresponds to the interval of repetition of the pattern.</param>
60+
/// <param name="Solidity">Sets the solidity of the pattern fill. Solidity is roughly the fraction of the area filled by the pattern. Solidity of 0 shows only the background color without pattern and solidty of 1 shows only the foreground color without pattern.</param>
4961
static member style
5062
(
5163
[<Optional; DefaultParameterValue(null)>] ?BGColor: Color,

src/Plotly.NET/plotly-2.23.2.min.js

-8
This file was deleted.

src/Plotly.NET/plotly-2.24.3.min.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Common/FSharpTestBase/FSharpTestBase.fsproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<ItemGroup>
99
<EmbeddedResource Include="..\..\..\docs\img\logo.png" />
10-
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.23.2.min.js" />
11-
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.23.2.min.js.LICENSE.txt" />
10+
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.24.3.min.js" />
11+
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.24.3.min.js.LICENSE.txt" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
@@ -21,6 +21,7 @@
2121
<Compile Include="TestCharts\ChartCarpetTestCharts.fs" />
2222
<Compile Include="TestCharts\ChartDomainTestCharts.fs" />
2323
<Compile Include="TestCharts\ChartSmithTestCharts.fs" />
24+
<Compile Include="TestCharts\UpstreamFeatures\2.24.fs" />
2425
<Compile Include="TestCharts\UpstreamFeatures\2.23.fs" />
2526
<Compile Include="TestCharts\UpstreamFeatures\2.22.fs" />
2627
<Compile Include="TestCharts\UpstreamFeatures\2.21.fs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
module PlotlyJS_2_24_TestCharts
2+
3+
open Plotly.NET
4+
open Plotly.NET.TraceObjects
5+
open Plotly.NET.LayoutObjects
6+
7+
8+
module ``Marker pattern for pie, funnelarea, sunburst, icicle and treemap traces`` =
9+
10+
let ``Pie chart with section patterns`` =
11+
Chart.Pie(
12+
valuesLabels = [
13+
20, "yes"
14+
30, "nope"
15+
],
16+
MultiMarkerPatternShape = [
17+
StyleParam.PatternShape.Checked
18+
StyleParam.PatternShape.Dots
19+
],
20+
UseDefaults = false
21+
)
22+
23+
let ``Donut chart with section patterns`` =
24+
Chart.Doughnut(
25+
valuesLabels = [
26+
20, "yes"
27+
30, "nope"
28+
],
29+
MultiMarkerPatternShape = [
30+
StyleParam.PatternShape.Checked
31+
StyleParam.PatternShape.Dots
32+
],
33+
UseDefaults = false
34+
)
35+
36+
let ``FunnelArea chart with section patterns`` =
37+
Chart.FunnelArea(
38+
valuesLabels = [
39+
20, "yes"
40+
30, "nope"
41+
],
42+
MultiMarkerPatternShape = [
43+
StyleParam.PatternShape.Checked
44+
StyleParam.PatternShape.Dots
45+
],
46+
UseDefaults = false
47+
)
48+
49+
let ``Sunburst chart with section patterns`` =
50+
Chart.Sunburst(
51+
labels = [ "A"; "B"; "C"; "D"; "E" ],
52+
parents = [ ""; ""; "B"; "B"; "" ],
53+
Values = [ 5.; 0.; 3.; 2.; 3. ],
54+
MultiText = [ "At"; "Bt"; "Ct"; "Dt"; "Et" ],
55+
MultiMarkerPatternShape = [
56+
StyleParam.PatternShape.Checked
57+
StyleParam.PatternShape.Dots
58+
StyleParam.PatternShape.DiagonalChecked
59+
StyleParam.PatternShape.HorizontalLines
60+
StyleParam.PatternShape.None
61+
],
62+
UseDefaults = false
63+
)
64+
65+
let ``Treemap chart with section patterns`` =
66+
Chart.Treemap(
67+
labels = [ "A"; "B"; "C"; "D"; "E" ],
68+
parents = [ ""; ""; "B"; "B"; "" ],
69+
Values = [ 5.; 0.; 3.; 2.; 3. ],
70+
MultiText = [ "At"; "Bt"; "Ct"; "Dt"; "Et" ],
71+
MultiMarkerPatternShape = [
72+
StyleParam.PatternShape.Checked
73+
StyleParam.PatternShape.Dots
74+
StyleParam.PatternShape.DiagonalChecked
75+
StyleParam.PatternShape.HorizontalLines
76+
StyleParam.PatternShape.None
77+
],
78+
UseDefaults = false
79+
)
80+
81+
let ``Icicle chart with section patterns`` =
82+
Chart.Icicle(
83+
labels = [ "A"; "B"; "C"; "D"; "E" ],
84+
parents = [ ""; ""; "B"; "B"; "" ],
85+
Values = [ 5.; 0.; 3.; 2.; 3. ],
86+
MultiText = [ "At"; "Bt"; "Ct"; "Dt"; "Et" ],
87+
MultiMarkerPatternShape = [
88+
StyleParam.PatternShape.Checked
89+
StyleParam.PatternShape.Dots
90+
StyleParam.PatternShape.DiagonalChecked
91+
StyleParam.PatternShape.HorizontalLines
92+
StyleParam.PatternShape.None
93+
],
94+
UseDefaults = false
95+
)

tests/ConsoleApps/FSharpConsole/Program.fs

+59-29
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,65 @@ open Newtonsoft.Json
1212
[<EntryPoint>]
1313
let main argv =
1414
[
15-
Chart.Point([1,2], UseDefaults = false)
16-
|> Chart.withLegendAnchor 1
17-
Chart.Point([100,200], UseDefaults = false)
18-
|> Chart.withLegendAnchor 2
19-
]
20-
|> Chart.combine
21-
|> Chart.withLegend(
22-
Legend.init(
23-
X = 0.25,
24-
Y = 0.25,
25-
BorderColor = Color.fromKeyword Blue,
26-
BorderWidth = 2,
27-
Title = Title.init(
28-
Text = "Legend 1"
29-
)
30-
),
31-
Id = 1
32-
)
33-
|> Chart.withLegend(
34-
Legend.init(
35-
X = 0.75,
36-
Y = 0.75,
37-
BorderColor = Color.fromKeyword Red,
38-
BorderWidth = 2,
39-
Title = Title.init(
40-
Text = "Legend 2"
15+
Chart.Point(xy = [1,2; 2,3], Name = "2D Cartesian", UseDefaults = false)
16+
Chart.Point3D(xyz = [1,3,2], Name = "3D Cartesian", UseDefaults = false)
17+
Chart.PointPolar(rTheta = [10,20], Name = "Polar", UseDefaults = false)
18+
Chart.PointGeo(lonlat = [1,2], Name = "Geo", UseDefaults = false)
19+
Chart.PointMapbox(lonlat = [1,2], Name = "MapBox", UseDefaults = false) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap))
20+
Chart.PointTernary(abc = [1,2,3; 2,3,4], Name = "Ternary", UseDefaults = false)
21+
[
22+
Chart.Carpet(
23+
carpetId = "contour",
24+
A = [0.; 1.; 2.; 3.; 0.; 1.; 2.; 3.; 0.; 1.; 2.; 3.],
25+
B = [4.; 4.; 4.; 4.; 5.; 5.; 5.; 5.; 6.; 6.; 6.; 6.],
26+
X = [2.; 3.; 4.; 5.; 2.2; 3.1; 4.1; 5.1; 1.5; 2.5; 3.5; 4.5],
27+
Y = [1.; 1.4; 1.6; 1.75; 2.; 2.5; 2.7; 2.75; 3.; 3.5; 3.7; 3.75],
28+
AAxis = LinearAxis.initCarpet(
29+
TickPrefix = "a = ",
30+
Smoothing = 0.,
31+
MinorGridCount = 9,
32+
AxisType = StyleParam.AxisType.Linear
33+
),
34+
BAxis = LinearAxis.initCarpet(
35+
TickPrefix = "b = ",
36+
Smoothing = 0.,
37+
MinorGridCount = 9,
38+
AxisType = StyleParam.AxisType.Linear
39+
),
40+
UseDefaults = false,
41+
Opacity = 0.75
42+
)
43+
Chart.ContourCarpet(
44+
z = [1.; 1.96; 2.56; 3.0625; 4.; 5.0625; 1.; 7.5625; 9.; 12.25; 15.21; 14.0625],
45+
carpetAnchorId = "contour",
46+
A = [0; 1; 2; 3; 0; 1; 2; 3; 0; 1; 2; 3],
47+
B = [4; 4; 4; 4; 5; 5; 5; 5; 6; 6; 6; 6],
48+
UseDefaults = false,
49+
ContourLineColor = Color.fromKeyword White,
50+
ShowContourLabels = true,
51+
ShowScale = false
4152
)
42-
),
43-
Id = 2
44-
)
53+
]
54+
|> Chart.combine
55+
Chart.Pie(values = [10;40;50;], Name = "Domain", UseDefaults = false)
56+
Chart.BubbleSmith(
57+
real = [0.5; 1.; 2.; 3.],
58+
imag = [0.5; 1.; 2.; 3.],
59+
sizes = [10;20;30;40],
60+
MultiText=["one";"two";"three";"four";"five";"six";"seven"],
61+
TextPosition=StyleParam.TextPosition.TopCenter,
62+
Name = "Smith",
63+
UseDefaults = false
64+
)
65+
[
66+
// you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case)
67+
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.]
68+
Chart.BoxPlot(X = "y" ,Y = y,Name="Combined 1",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
69+
Chart.BoxPlot(X = "y'",Y = y,Name="Combined 2",Jitter=0.1,BoxPoints=StyleParam.BoxPoints.All, UseDefaults = false);
70+
]
71+
|> Chart.combine
72+
]
73+
|> Chart.Grid(4,3)
74+
|> Chart.withSize(1000,1000)
4575
|> Chart.show
4676
0

tests/CoreTests/CoreTests/CoreTests.fsproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.23.2.min.js" />
12-
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.23.2.min.js.LICENSE.txt" />
11+
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.24.3.min.js" />
12+
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.24.3.min.js.LICENSE.txt" />
1313
<!--HTMLCodegen-->
1414
<Compile Include="HTMLCodegen\Chart2D.fs" />
1515
<Compile Include="HTMLCodegen\Chart3D.fs" />
@@ -36,6 +36,7 @@
3636
<Compile Include="Traces\TraceStaticMembers.fs" />
3737
<Compile Include="Traces\TraceStyle.fs" />
3838
<Compile Include="Traces\TraceID.fs" />
39+
<Compile Include="UpstreamFeatures\2.24.fs" />
3940
<Compile Include="UpstreamFeatures\2.23.fs" />
4041
<Compile Include="UpstreamFeatures\2.22.fs" />
4142
<Compile Include="UpstreamFeatures\2.21.fs" />

0 commit comments

Comments
 (0)