Skip to content

Commit 2c2eb0e

Browse files
committed
Add Wind Rose chart and docs
1 parent 1174a9e commit 2c2eb0e

19 files changed

+1814
-92
lines changed

FSharp.Plotly.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D
4747
docs\content\polar-charts.fsx = docs\content\polar-charts.fsx
4848
docs\content\range-plots.fsx = docs\content\range-plots.fsx
4949
docs\content\shapes.fsx = docs\content\shapes.fsx
50+
docs\content\windrose-charts.fsx = docs\content\windrose-charts.fsx
5051
EndProjectSection
5152
EndProject
5253
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}"

docs/content/3d-line-plots.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let x,y,z =
2626

2727

2828
(*** define-output:scatter3d_line_1 ***)
29-
Chart.Scatter3d(x,y,z,StyleOption.Mode.Lines_Markers)
29+
Chart.Scatter3d(x,y,z,StyleParam.Mode.Lines_Markers)
3030
|> Chart.withX_AxisStyle("x-axis")
3131
|> Chart.withY_AxisStyle("y-axis")
3232
|> Chart.withZ_AxisStyle("z-axis")

docs/content/bar-charts.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ let keys = ["Product A"; "Product B"; "Product C";]
1919
let labels = ["27% market share"; "24% market share"; "19% market share";]
2020

2121
(*** define-output:bar1 ***)
22-
Chart.Column(keys,values,Labels=labels,Opacity=0.3,Marker=Options.Marker(Color="rgba(222,45,38,0.8)",Size=1)) // Changing the thickness of the bar is not possible at the moment
22+
Chart.Column(keys,values,Labels=labels,Opacity=0.3,Marker=Marker.init(Marker.style (Color="rgba(222,45,38,0.8)",Size=1))) // Changing the thickness of the bar is not possible at the moment
2323
(*** include-it:bar1 ***)
24+
|> Chart.Show
2425

2526
(*** define-output:bar2 ***)
2627
Chart.Bar(keys,values)
@@ -43,4 +44,3 @@ The following example shows how to create a stacked bar chart by combining bar c
4344
(*** include-it:bar3 ***)
4445
|> Chart.Show
4546

46-
FSharp.Plotly.

docs/content/box-plots.fsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
1919
let x = ["bin1";"bin2";"bin1";"bin2";"bin1";"bin2";"bin1";"bin1";"bin2";"bin1"]
2020

2121
(*** define-output:box1 ***)
22-
Chart.BoxPlot(x,y,Jitter=0.1,Boxpoints=StyleOption.Boxpoints.All)
22+
Chart.BoxPlot(x,y,Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All)
2323
(*** include-it:box1 ***)
2424

2525
(**
26-
By swapping x and y plus using `StyleOption.Orientation.Horizontal` we can flip the chart horizontaly.
26+
By swapping x and y plus using `StyleParam.Orientation.Horizontal` we can flip the chart horizontaly.
2727
*)
2828
(*** define-output:box2 ***)
29-
Chart.BoxPlot(y,x,Jitter=0.1,Boxpoints=StyleOption.Boxpoints.All,Orientation=StyleOption.Orientation.Horizontal)
29+
Chart.BoxPlot(y,x,Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All,Orientation=StyleParam.Orientation.Horizontal)
3030
(*** include-it:box2 ***)
3131

3232

@@ -39,8 +39,8 @@ 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.
3939

4040
(*** define-output:box3 ***)
4141
[
42-
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,Boxpoints=StyleOption.Boxpoints.All);
43-
Chart.BoxPlot("y'",y',Name="bin2",Jitter=0.1,Boxpoints=StyleOption.Boxpoints.All);
42+
Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All);
43+
Chart.BoxPlot("y'",y',Name="bin2",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All);
4444
]
4545
|> Chart.Combine
4646
(*** include-it:box3 ***)

docs/content/line-scatter-plots.fsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
2222

2323
(*** define-output:line1 ***)
2424
Chart.Line(x,y',Name="line")
25-
|> Chart.withLineStyle(Width=2,Dash=StyleOption.DrawingStyle.Dot)
25+
|> Chart.withLineStyle(Width=2,Dash=StyleParam.DrawingStyle.Dot)
2626
(*** include-it:line1 ***)
2727

2828
(**
@@ -43,8 +43,8 @@ shown below.
4343

4444
(*** define-output:line3 ***)
4545
Chart.Spline(x,y',Name="spline")
46-
|> Chart.withLineStyle(Width=2,Dash=StyleOption.DrawingStyle.Dot)
47-
|> Chart.withLineStyle(Width=6,Dash=StyleOption.DrawingStyle.Dot)
46+
|> Chart.withLineStyle(Width=2,Dash=StyleParam.DrawingStyle.Dot)
47+
|> Chart.withLineStyle(Width=6,Dash=StyleParam.DrawingStyle.Dot)
4848
(*** include-it:line3 ***)
4949

5050

@@ -60,16 +60,15 @@ If `TextPosition` is set the labels are drawn otherwise only shown when hovering
6060
let l = ["a";"b";"c";"d";"e";"f";"g";"h";"i";"j";]
6161

6262
(*** define-output:pointsWithLabels ***)
63-
Chart.Point(x,y',Name="points",Labels=l,TextPosition=StyleOption.TextPosition.TopRight)
63+
Chart.Point(x,y',Name="points",Labels=l,TextPosition=StyleParam.TextPosition.TopRight)
6464
(*** include-it:pointsWithLabels ***)
6565
|> Chart.Show
6666

6767

6868

69-
70-
(*** define-output:pointsWithErrorBars ***)
71-
Chart.Point(x,y',Name="points with errors")
72-
|> Chart.withXError(Options.Error(Array=[|0.2;0.3;0.2;0.1;0.2;0.4;0.2;0.08;0.2;0.1;|]))
73-
|> Chart.withYError(Options.Error(Array=[|0.3;0.2;0.1;0.4;0.2;0.4;0.1;0.18;0.02;0.2;|]))
74-
(*** include-it:pointsWithErrorBars ***)
75-
|> Chart.Show
69+
//(*** define-output:pointsWithErrorBars ***)
70+
//Chart.Point(x,y',Name="points with errors")
71+
//|> Chart.withXError(Options.Error(Array=[|0.2;0.3;0.2;0.1;0.2;0.4;0.2;0.08;0.2;0.1;|]))
72+
//|> Chart.withYError(Options.Error(Array=[|0.3;0.2;0.1;0.4;0.2;0.4;0.1;0.18;0.02;0.2;|]))
73+
//(*** include-it:pointsWithErrorBars ***)
74+
//|> Chart.Show

docs/content/polar-charts.fsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,32 @@
33
#r "../../bin/FSharp.Plotly.dll"
44

55
(**
6-
# FSharp.Plotly: Pie and Doughnut Charts
6+
# FSharp.Plotly: Polar chart
77
8-
*Summary:* This example shows how to create pie and doughnut charts in F#.
8+
*Summary:* This example shows how to create polar charts in F#.
99
10-
A pie or a doughnut chart can be created using the `Chart.Pie` and `Chart.Doughnut` functions.
11-
When creating pie or doughnut charts, it is usually desirable to provide both labels and
12-
values.
10+
A polar chart is a graphical method of displaying multivariate data in the form of a two-dimensional chart
11+
of three or more quantitative variables represented on axes starting from the same point.
12+
The relative position and angle of the axes is typically uninformative.
1313
*)
1414

1515
open FSharp.Plotly
1616

17-
let values = [19; 26; 55;]
18-
let labels = ["Residential"; "Non-Residential"; "Utility"]
17+
let r = [1; 2; 3; 4; 5; 6; 7;]
18+
let r' = [ 5; 6; 7; 1; 2; 3; 4;]
19+
let r'' = [ 3; 1; 5; 2; 8; 7; 5;]
20+
21+
22+
let t = [0; 45; 90; 135; 200; 320; 184;]
1923

20-
(*** define-output:pie1 ***)
21-
Chart.Pie(values,labels)
22-
(*** include-it:pie1 ***)
24+
(*** define-output:polar1 ***)
25+
[
26+
Chart.Polar(r,t,StyleParam.Mode.Markers,Name="1")
27+
Chart.Polar(r',t,StyleParam.Mode.Markers,Name="2")
28+
Chart.Polar(r'',t,StyleParam.Mode.Markers,Name="3")
29+
]
30+
|> Chart.Combine
31+
(*** include-it:polar1 ***)
32+
|> Chart.Show
33+
2334

24-
(*** define-output:doughnut1 ***)
25-
Chart.Doughnut(values,labels,hole=0.3)
26-
(*** include-it:doughnut1 ***)

docs/content/shapes.fsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(*** hide ***)
1+
(*** side ***)
22
#r "../../bin/Newtonsoft.Json.dll"
33
#r "../../bin/FSharp.Plotly.dll"
44

@@ -14,12 +14,19 @@ open FSharp.Plotly
1414
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
1515
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
1616

17-
let s1 = Shape.init (Shape.ShapeStyle.Shape(StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3") )
18-
let s2 = Shape.init (Shape.ShapeStyle.Shape(StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3") )
17+
let s1 =
18+
Shape.init
19+
( Shape.style
20+
( StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3" )
21+
)
22+
let s2 =
23+
Shape.init
24+
( Shape.style
25+
( StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3" )
26+
)
1927
(*** define-output:line1 ***)
2028
Chart.Line(x,y',Name="line")
21-
//|> Chart.withShape(Options.Shape(StyleOption.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3"))
29+
//|> Chart.withShape(Options.Shape(StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3"))
2230
|> Chart.withShapes([s1;s2])
2331
(*** include-it:line1 ***)
24-
|> Chart.Show
2532

docs/content/windrose-charts.fsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
(*** hide ***)
2+
#r "../../bin/Newtonsoft.Json.dll"
3+
#r "../../bin/FSharp.Plotly.dll"
4+
5+
(**
6+
# FSharp.Plotly: Wind Rose chart
7+
8+
*Summary:* This example shows how to create wind rose charts in F#.
9+
10+
A wind rose is a graphic tool used by meteorologists to give a succinct view
11+
of how wind speed and direction are typically distributed at a particular location.
12+
*)
13+
14+
open FSharp.Plotly
15+
16+
let r = [77.5; 72.5; 70.0; 45.0; 22.5; 42.5; 40.0; 62.5]
17+
let r' = [57.5; 50.0; 45.0; 35.0; 20.0; 22.5; 37.5; 55.0]
18+
let r'' = [40.0; 30.0; 30.0; 35.0; 7.5; 7.5; 32.5; 40.0]
19+
let r''' = [20.0; 7.5; 15.0; 22.5; 2.5; 2.5; 12.5; 22.5]
20+
21+
let t = ["North"; "N-E"; "East"; "S-E"; "South"; "S-W"; "West"; "N-W"]
22+
23+
(*** define-output:polar1 ***)
24+
[
25+
Chart.WindRose (r ,t,Name="11-14 m/s")
26+
Chart.WindRose (r' ,t,Name="8-11 m/s")
27+
Chart.WindRose (r'' ,t,Name="5-8 m/s")
28+
Chart.WindRose (r''',t,Name="< 5 m/s")
29+
]
30+
|> Chart.Combine
31+
(*** include-it:polar1 ***)
32+
|> Chart.Show
33+
34+

docs/tools/templates/template.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<li><a href="@Root/line-scatter-plots.html">Line and Scatter Plots</a></li>
5555
<li><a href="@Root/pie-daughnut-charts.html">Pie and Doughnut Charts</a></li>
5656
<li><a href="@Root/polar-charts.html">Polar Charts</a></li>
57+
<li><a href="@Root/windrose-charts.html">Polar Charts</a></li>
5758
<li><a href="@Root/range-plots.html">Range Plots</a></li>
5859
<li class="nav-header">Plotly 3d-Charts</li>
5960
<li><a href="@Root/3d-scatter-plots.html">3D Scatter Plots</a></li>

0 commit comments

Comments
 (0)