0

Is it possible to run Plotly.Net offline with F#?

You can store "plotly-2.6.3.min.js" and "require.min.js" locally and replace paths to html/javascript and see graphs. But when using Geo Maps, how to handle with world_50m or world_110m.json as needed also to draw a map?

For example first "baseMapOnly" from here https://plotly.net/05_0_geo-vs-mapbox.html and world_110m.json downloaded and pointed to GeoJson:

open Plotly.NET

// world_110m.json stored locally 
let geoJsondata =
  IO.File.ReadAllText("world_110m.json")
  |> JsonConvert.DeserializeObject

let baseMapOnly = 
    Chart.PointGeo(GeoJson = geoJsondata, locations = [])
    |> Chart.withMarginSize(0,0,0,0)
     ....

baseMapOnly
|> Chart.show

Also "https://cdn.plot.ly" and "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6" of generated html replaced to local paths of "plotly-2.6.3.min.js" and "require.min.js".

When I try to render a map plot, there is still a call to https://cdn.plot.y/world_110m.json even though paths changed to html file.

What is wrong? Is there some other place to add local path?

RAh
  • 11
  • 3

1 Answers1

0

The latest version (4.0.0) should cover your bases. The Config object was fully implemented, meaning you can now set TopojsonURL, and there is also an option to fully include plotly.js in the html head by setting PlotlyJSReference = Full on the chart's DisplayOptions, meaning the document is truly offline:

Chart.PointGeo(GeoJson = geoJsondata, locations = [])
|> Chart.withConfigStyle(
    TopojsonURL = "your-url-here"
)
|> Chart.withDisplayOptionsStyle(
    PlotlyJSReference = Full
)
|> Chart.show
kMutagene
  • 177
  • 10