Skip to content

Commit c62ea0d

Browse files
committed
Add verbose SAveAs method
1 parent 56c935f commit c62ea0d

File tree

7 files changed

+354
-4
lines changed

7 files changed

+354
-4
lines changed

FSharp.Plotly.sln

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion = 15.0.27004.2002
3+
VisualStudioVersion = 15.0.27004.2010
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}"
66
ProjectSection(SolutionItems) = preProject
@@ -36,12 +36,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D
3636
docs\content\box-plots.fsx = docs\content\box-plots.fsx
3737
docs\content\bubble-charts.fsx = docs\content\bubble-charts.fsx
3838
docs\content\contour-plots.fsx = docs\content\contour-plots.fsx
39+
docs\content\errorbars.fsx = docs\content\errorbars.fsx
3940
docs\content\extensions.fsx = docs\content\extensions.fsx
4041
docs\content\getting-started.fsx = docs\content\getting-started.fsx
4142
docs\content\heatmaps.fsx = docs\content\heatmaps.fsx
4243
docs\content\histograms.fsx = docs\content\histograms.fsx
4344
docs\content\index.fsx = docs\content\index.fsx
4445
docs\content\line-scatter-plots.fsx = docs\content\line-scatter-plots.fsx
46+
docs\content\multiple-charts.fsx = docs\content\multiple-charts.fsx
4547
docs\content\parallel-coords.fsx = docs\content\parallel-coords.fsx
4648
docs\content\pie-daughnut-charts.fsx = docs\content\pie-daughnut-charts.fsx
4749
docs\content\plotly-wpf.fsx = docs\content\plotly-wpf.fsx

docs/content/errorbars.fsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
(*** hide ***)
2+
// This block of code is omitted in the generated HTML documentation. Use
3+
// it to define helpers that you do not want to show in the documentation.
4+
#r "../../bin/Newtonsoft.Json.dll"
5+
#r "../../lib/FSharp.Care.dll"
6+
7+
(**
8+
Multiple charts and subcharts
9+
=============================
10+
11+
How to create subplots in FSharp.Plotly. Find examples of combined, stacked, and plots with multiple axis.
12+
13+
*)
14+
15+
#r "../../bin/FSharp.Plotly.dll"
16+
open FSharp.Plotly
17+
18+
19+
(**
20+
Functional F# scripting style for Two Y-Axes
21+
*)
22+
23+
[
24+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
25+
|> Chart.withAxisAnchor(Y=1);
26+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
27+
|> Chart.withAxisAnchor(Y=2);
28+
]
29+
|> Chart.Combine
30+
|> Chart.withY_AxisStyle("first",Side=StyleParam.Side.Left,Id=1)
31+
|> Chart.withY_AxisStyle("second",Side=StyleParam.Side.Right,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1)
32+
|> Chart.Show
33+
34+
35+
36+
(**
37+
Functional F# scripting style for Two Y-Axes same side
38+
*)
39+
40+
[
41+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
42+
|> Chart.withAxisAnchor(Y=1);
43+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
44+
|> Chart.withAxisAnchor(Y=2);
45+
]
46+
|> Chart.Combine
47+
|> Chart.withX_AxisStyle("x-axis",Domain=(0.3, 1.0))
48+
|> Chart.withY_AxisStyle("first y-axis")
49+
|> Chart.withY_AxisStyle("second y-axis",Side=StyleParam.Side.Left,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1,Position=0.15,Anchor=StyleParam.AxisAnchorId.Free)
50+
|> Chart.Show
51+
52+
53+
54+
// Simple Subplot
55+

docs/content/multiple-charts.fsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
(*** hide ***)
2+
// This block of code is omitted in the generated HTML documentation. Use
3+
// it to define helpers that you do not want to show in the documentation.
4+
#r "../../bin/Newtonsoft.Json.dll"
5+
#r "../../lib/FSharp.Care.dll"
6+
7+
(**
8+
Multiple charts and subcharts
9+
=============================
10+
11+
How to create subplots in FSharp.Plotly. Find examples of combined, stacked, and plots with multiple axis.
12+
13+
*)
14+
15+
#r "../../bin/FSharp.Plotly.dll"
16+
open FSharp.Plotly
17+
18+
19+
(**
20+
Functional F# scripting style for Two Y-Axes
21+
*)
22+
23+
[
24+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
25+
|> Chart.withAxisAnchor(Y=1);
26+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
27+
|> Chart.withAxisAnchor(Y=2);
28+
]
29+
|> Chart.Combine
30+
|> Chart.withY_AxisStyle("first",Side=StyleParam.Side.Left,Id=1)
31+
|> Chart.withY_AxisStyle("second",Side=StyleParam.Side.Right,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1)
32+
|> Chart.Show
33+
34+
35+
36+
(**
37+
Functional F# scripting style for Two Y-Axes same side
38+
*)
39+
40+
[
41+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],StyleParam.Mode.Lines_Markers,Name="anchor 1")
42+
|> Chart.withAxisAnchor(Y=1);
43+
Chart.Line([1; 2; 3; 4],[90; 110; 190; 120],Name="anchor 2")
44+
|> Chart.withAxisAnchor(Y=2);
45+
]
46+
|> Chart.Combine
47+
|> Chart.withX_AxisStyle("x-axis",Domain=(0.3, 1.0))
48+
|> Chart.withY_AxisStyle("first y-axis")
49+
|> Chart.withY_AxisStyle("second y-axis",Side=StyleParam.Side.Left,Id=2,Overlaying=StyleParam.AxisAnchorId.Y 1,Position=0.15,Anchor=StyleParam.AxisAnchorId.Free)
50+
|> Chart.Show
51+
52+
53+
54+
// Simple Subplot
55+

docs/tools/templates/template.cshtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
<li><a href="@Root/heatmaps.html">Heatmaps</a></li>
5252
<li><a href="@Root/histograms.html">Histograms</a></li>
5353
<li><a href="@Root/2d-histograms.html">2D Histograms</a></li>
54-
<li><a href="@Root/line-scatter-plots.html">Line and Scatter Plots</a></li>
54+
<li><a href="@Root/line-scatter-plots.html">Line and Scatter Plots</a></li>
55+
<li><a href="@Root/parallel-coords.html">Parallel coords Plots</a></li>
5556
<li><a href="@Root/pie-daughnut-charts.html">Pie and Doughnut Charts</a></li>
5657
<li><a href="@Root/polar-charts.html">Polar Charts</a></li>
5758
<li><a href="@Root/windrose-charts.html">Windrose Charts</a></li>
@@ -62,6 +63,8 @@
6263
<li><a href="@Root/3d-surface-plots.html">3D Surface Plots</a></li>
6364
<li><a href="@Root/3d-mesh-plots.html">3D Mesh Plots</a></li>
6465
<li class="nav-header">Styling</li>
66+
<li><a href="@Root/multiple-charts.html">Multiple Charts</a></li>
67+
<li><a href="@Root/errorbars.html">Error bars</a></li>
6568
<li><a href="@Root/shapes.html">Shapes</a></li>
6669
<li class="nav-header">Plotly WPF</li>
6770
<li><a href="@Root/plotly-wpf.html">Using Plotly PopUp window</a></li>

src/FSharp.Plotly/ChartExtensions.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,14 @@ module ChartExtensions =
305305
GenericChart.combine gCharts
306306

307307
/// Save chart as html single page
308-
static member SaveHtmlAs pathName (ch:GenericChart) =
308+
static member SaveHtmlAs pathName (ch:GenericChart,?Verbose) =
309309
let html = GenericChart.toEmbeddedHTML ch
310310
let file = sprintf "%s.html" pathName // remove file extension
311311
File.WriteAllText(file, html)
312-
System.Diagnostics.Process.Start(file) |> ignore
312+
313+
let verbose = defaultArg Verbose false
314+
if verbose then
315+
System.Diagnostics.Process.Start(file) |> ignore
313316

314317

315318
/// Show chart in browser

0 commit comments

Comments
 (0)