-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
Description
I cannot get GenericChart.toChartHTML to render in fsdocs generated pages with Plotly.NET 4.0. I think it's because 4.0 is not producing the fsharpPlotlyRequire javascript in the output.
Repro steps
If I do this in a blank docs folder index.fsx I get a nice plot produced in the html
#r "nuget: Plotly.NET, 3.*"
open Plotly.NET
Chart.Line([1,2; 3, 4])
|> GenericChart.toChartHTML
(***include-it-raw***)However, with 4.0 no chart gets displayed:

Comparing the html output vs. 3.0, I think 4.0 missing the fsharpPlotlyRequire ... code?
see that in 4.0 there is no fsharpPlotlyRequire code before the data declaration in the output:
#r "nuget: Plotly.NET, 4.*"
open Plotly.NET
Chart.Line([1,2; 3, 4])
|> GenericChart.toChartHTML
> val it: string =
"<div><div id="0acfb4b0-43b3-421f-adaf-849ee352d955"><!-- Plotly chart will be drawn inside this DIV --></div><script type="text/javascript">var renderPlotly_0acfb4b043b3421fadaf849ee352d955 = function() {
var data = [{"type":"scatter","mode":"lines","x":[1,3],"y":[2,4],"marker":{},"line":{}}]
There is an fsharpPlotlyRequire function in the 3.0 output:
#r "nuget: Plotly.NET, 3.*"
open Plotly.NET
Chart.Line([1,2; 3, 4])
|> GenericChart.toChartHTML
> val it: string =
"<div id="5347e62f-9fc9-4c6e-88f1-c3d40ad1f5d8"><!-- Plotly chart will be drawn inside this DIV --></div>
<script type="text/javascript">
var renderPlotly_5347e62f9fc94c6e88f1c3d40ad1f5d8 = function() {
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.6.3.min'}}) || require;
fsharpPlotlyRequire(['plotly'], function(Plotly) {
var data = [{"type":"scatter","mode":"lines","x":[1,3],"y":[2,4],"marker":{},"line":{}}];Related information
- Operating system: Windows
- fsdocs: tried 16.1.1 and 17.3.0
- .NET Runtime, CoreCLR or Mono Version: dotnet --version = 7.0.100
Reactions are currently unavailable