-
Notifications
You must be signed in to change notification settings - Fork 99
Add possibility to save charts as images programmatically #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 |
On the first look, this actually seems to be less overhead than using Orca in a docker container, thanks for the tip! |
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: |
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 |
The way to go here is providing a Kaleido interface to render Plotly.NET Charts as images. |
I'd like to register my interest in this feature so that I can easily include F#-generated figures in latex documents. |
I've published a package that uses PuppeteerSharp and Chromium to render charts. var chart = Chart.Line<int, int, int, int>(
x: new[] { 1, 2, 3 },
y: new[] { 4, 5, 6 }
);
await using var renderer = await PlotlyRenderer.FetchBrowserAndLaunch();
var png = await renderer.Render(1024, 768, chart.ToFullScreenHtml());
await File.WriteAllBytesAsync("chart.png", png); |
@ilyalatt thanks for that! |
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.
The text was updated successfully, but these errors were encountered: