You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add possibility to save charts as images programmatically #21
Creating images locally without having to open plots and click on the save as image button would be awesome. This however will take some work.
The only way i found to do this so far is using Orca, which is a command line utility that plotly itself uses to render images. Orca can be either installes as npm module, conda package, or deployed as a docker container. All of these add some overhead but i still think this is usefull. I will start to implement some functions to call orca functions and we will see how it goes.
It is overkill but it would be possible to use Puppeteer-Sharp to render the page and then either inject JavaScript and take the screenshot or use Puppeteer to take the screenshot on page render finish
no worries, excited to see this feature incorporated!
idk if plotly will allow you to but you might want to wait for a response from plotly to confirm that the chart has been rendered and the page is done. A dirty way would just be a fixed delay as well
I've published a package that uses PuppeteerSharp and Chromium to render charts.
It's called Plotly.NET.PuppeteerRenderer.
The code is written in C# but it should not be a problem to use it in F#.
Here's a snippet:
Activity
sanchez commentedon May 24, 2020
It is overkill but it would be possible to use Puppeteer-Sharp to render the page and then either inject JavaScript and take the screenshot or use Puppeteer to take the screenshot on page render finish
kMutagene commentedon May 25, 2020
On the first look, this actually seems to be less overhead than using Orca in a docker container, thanks for the tip!
kMutagene commentedon May 25, 2020
thanks again @sanchez , i had a short go at it and it instantly worked. Here is a POC gist for future reference:
https://gist.github.com/kMutagene/afadbd5b9cb8e6b0401e94338a2644e4
the rendered chart:
sanchez commentedon May 25, 2020
no worries, excited to see this feature incorporated!
idk if plotly will allow you to but you might want to wait for a response from plotly to confirm that the chart has been rendered and the page is done. A dirty way would just be a fixed delay as well
kMutagene commentedon Sep 14, 2020
The way to go here is providing a Kaleido interface to render Plotly.NET Charts as images.
nhirschey commentedon Feb 23, 2021
I'd like to register my interest in this feature so that I can easily include F#-generated figures in latex documents.
ilyalatt commentedon Apr 17, 2021
I've published a package that uses PuppeteerSharp and Chromium to render charts.
It's called Plotly.NET.PuppeteerRenderer.
The code is written in C# but it should not be a problem to use it in F#.
Here's a snippet:
kMutagene commentedon Apr 20, 2021
@ilyalatt thanks for that!
kMutagene commentedon Jul 12, 2021
closed via #94. The docs for the new
Plotly.NET.ImageExportpackage can be found here