Skip to content

Commit 90f5ff9

Browse files
muehlmuehl
authored andcommitted
Add withErrorStyle and some chart docs
1 parent 9a4a1ca commit 90f5ff9

File tree

10 files changed

+43
-19
lines changed

10 files changed

+43
-19
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let z' = [
5858
[1.;2.;];
5959
] // column (length y)
6060

61-
Chart.Surface(z',x',y',Opacity=0.,Contours=Contours.initContours(Contours.ContoursStyle.XyzContours(Show=true)))
62-
|> Chart.Show
61+
//Chart.Surface(z',x',y',Opacity=0.,Contours=Contours. init(Contours.styleXyz(Show=true)))
62+
//|> Chart.Show
6363

6464

docs/content/bar-charts.fsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ 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(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 ***)
2424

25+
2526
(*** define-output:bar2 ***)
2627
Chart.Bar(keys,values)
2728
(*** include-it:bar2 ***)
@@ -41,6 +42,5 @@ The following example shows how to create a stacked bar chart by combining bar c
4142
]
4243
|> Chart.Combine
4344
(*** include-it:bar3 ***)
44-
|> Chart.Show
4545

46-
FSharp.Plotly.
46+

docs/content/contour-plots.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ let z =
4444
z
4545
|> Chart.Contour
4646
|> Chart.withSize(600.,600.)
47-
(*** include-it:contour1 ***)
47+
(*** include-it:contour1 ***)

docs/content/heatmaps.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let colnames = ["Tp0";"Tp30";"Tp60";"Tp160"]
2626

2727
let colorscaleValue =
2828
//StyleParam.ColorScale.Electric
29-
StyleParam.ColorScale.Custom [(0.0,"#3D9970");(1.0,"#001f3f")]
29+
StyleParam.Colorscale.Custom [(0.0,"#3D9970");(1.0,"#001f3f")]
3030
// Generating the Heatmap
3131
(*** define-output:heat1 ***)
3232
Chart.Heatmap(matrix,colnames,rownames,Colorscale=colorscaleValue,Showscale=true)

docs/content/line-scatter-plots.fsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ Chart.Point(x,y',Name="points",Labels=l,TextPosition=StyleParam.TextPosition.Top
6767

6868

6969

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 ***)
70+
(*** define-output:pointsWithErrorBars ***)
71+
Chart.Point(x,y',Name="points with errors")
72+
|> Chart.withXErrorStyle (Array=[|0.2;0.3;0.2;0.1;0.2;0.4;0.2;0.08;0.2;0.1;|])
73+
|> Chart.withYErrorStyle (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 ***)
7575
//|> Chart.Show

docs/content/pie-daughnut-charts.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Chart.Pie(values,labels)
2222
(*** include-it:pie1 ***)
2323

2424
(*** define-output:doughnut1 ***)
25-
Chart.Doughnut(values,labels,Hole=0.3,Text=labels)
25+
Chart.Doughnut(values,labels,Hole=0.3,Textinfo=labels)
2626
(*** include-it:doughnut1 ***)
2727
|> Chart.Show
2828

docs/content/plotly-wpf.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ Create the combined chart
4141
By piping the combined chart into `Chart.Show` function it will be displayed in your browser.
4242
*)
4343
(*** do-not-eval ***)
44-
|> Chart.Show
44+
|> Chart.ShowWPF

docs/content/shapes.fsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ 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") )
19-
(*** define-output:line1 ***)
17+
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
18+
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
19+
(*** define-output:shapes ***)
2020
Chart.Line(x,y',Name="line")
2121
//|> Chart.withShape(Options.Shape(StyleOption.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3"))
2222
|> Chart.withShapes([s1;s2])
23-
(*** include-it:line1 ***)
24-
|> Chart.Show
23+
(*** include-it:shapes ***)
2524

src/FSharp.Plotly/ChartExtensions.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,32 @@ module ChartExtensions =
6262
ch |> mapTrace (TraceStyle.SetErrorX(xError))
6363
)
6464

65+
/// Apply styling to the xError(s) of the chart as Object
66+
static member withXErrorStyle(?Array,?Arrayminus,?Symmetric,?Color,?Thickness,?Width) =
67+
let error = Error.init(?Array=Array,?Arrayminus=Arrayminus,?Symmetric=Symmetric,?Color=Color,?Thickness=Thickness,?Width=Width)
68+
Chart.withXError error
69+
6570
/// Apply styling to the yError(s) of the chart as Object
6671
static member withYError(yError:Error) =
6772
(fun (ch:GenericChart) ->
6873
ch |> mapTrace (TraceStyle.SetErrorY(yError))
6974
)
7075

76+
/// Apply styling to the yError(s) of the chart as Object
77+
static member withYErrorStyle(?Array,?Arrayminus,?Symmetric,?Color,?Thickness,?Width) =
78+
let error = Error.init(?Array=Array,?Arrayminus=Arrayminus,?Symmetric=Symmetric,?Color=Color,?Thickness=Thickness,?Width=Width)
79+
Chart.withYError error
80+
7181
/// Apply styling to the zError(s) of the chart as Object
7282
static member withZError(zError:Error) =
7383
(fun (ch:GenericChart) ->
7484
ch |> mapTrace (TraceStyle.SetErrorZ(zError))
7585
)
86+
87+
/// Apply styling to the zError(s) of the chart as Object
88+
static member withZErrorStyle(?Array,?Arrayminus,?Symmetric,?Color,?Thickness,?Width) =
89+
let error = Error.init(?Array=Array,?Arrayminus=Arrayminus,?Symmetric=Symmetric,?Color=Color,?Thickness=Thickness,?Width=Width)
90+
Chart.withZError error
7691

7792

7893
// ############################################################

tasks.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
- [ ] Add missing chart: Polar chart
1010
- [ ] Add missing chart: Wind rose
1111
- [ ] Add missing chart: Mesh3d
12+
- [ ] Add missing chart: polar charts
13+
14+
- [ ] Add Contours.styleXyz
15+
16+
- [ ] Add missing docs: polar charts
17+
- [ ] Add missing docs: range plot
18+
- [ ] Add missing docs: histogram
19+
- [ ] Add missing docs: Mesh3d
20+
- [ ] Add missing docs: 3d-surface-plots
21+
1222

1323
- [x] Add support for Shapes
1424
- [ ] Add support for second axis

0 commit comments

Comments
 (0)