Skip to content

Commit fbf9892

Browse files
committed
Add xml docs for html generation, add obsolete note for ShowAsImage
1 parent 2aef860 commit fbf9892

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/Plotly.NET/ChartAPI/Chart.fs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ type Chart =
1717
//================================================ Core methods ================================================
1818
//==============================================================================================================
1919

20-
/// Save chart as html single page
20+
/// <summary>
21+
/// Saves the given Chart as html file at the given path (.html file extension is added if not present).
22+
/// Optionally opens the generated file in the browser.
23+
/// </summary>
24+
/// <param name="path">The path to save the chart html at.</param>
25+
/// <param name="OpenInBrowser">Wether or not to open the generated file in the browser (default: false)</param>
2126
[<CompiledName("SaveHtml")>]
2227
static member saveHtml(path: string, [<Optional; DefaultParameterValue(null)>] ?OpenInBrowser: bool) =
2328
fun (ch: GenericChart) ->
@@ -34,7 +39,10 @@ type Chart =
3439
File.WriteAllText(file, html)
3540
if show then file |> openOsSpecificFile
3641

37-
/// Show chart in browser
42+
/// <summary>
43+
/// Saves the given chart as a temporary html file and opens it in the browser.
44+
/// </summary>
45+
/// <param name="ch">The chart to show in the browser</param>
3846
[<CompiledName("Show")>]
3947
static member show(ch: GenericChart) =
4048
let guid = Guid.NewGuid().ToString()
@@ -43,7 +51,18 @@ type Chart =
4351
let path = Path.Combine(tempPath, file)
4452
ch |> Chart.saveHtml (path, true)
4553

46-
/// Show chart in browser
54+
/// <summary>
55+
/// Saves the given chart as a temporary html file containing a static image of the chart and opens it in the browser.
56+
///
57+
/// IMPORTANT: this is not the same as static image generation. The file still needs to be opened in the browser to generate the image, as it is done via a js script in the html.
58+
///
59+
/// For real programmatic static image export use Plotly.NET.ImageExport (https://www.nuget.org/packages/Plotly.NET.ImageExport/)
60+
///
61+
/// This yields basically the same results as using `StaticPlot = true` for the chart's config.
62+
/// </summary>
63+
/// <param name="format">The image format for the static chart</param>
64+
/// <param name="ch">The chart to show in the browser</param>
65+
[<Obsolete("This function will be dropped in the 2.0 release. It is recommended to either create static plots or use Plotly.NET.ImageExport instead.")>]
4766
[<CompiledName("ShowAsImage")>]
4867
static member showAsImage (format: StyleParam.ImageFormat) (ch: GenericChart) =
4968
let guid = Guid.NewGuid().ToString()

0 commit comments

Comments
 (0)