Giter Site home page Giter Site logo

Comments (4)

kMutagene avatar kMutagene commented on June 11, 2024

Hey @markus-renezeder,

My suspicion would be your application not being able to download chromium, which is the default behavior when you do not set a path to a local chromium executable. Chromium is needed for static image export, but not for html export, which further supports this suspicion. See for example #295 on how to point your application to a local chromium executable.

from plotly.net.

kMutagene avatar kMutagene commented on June 11, 2024

Also note that if you just want to display your chart in your webpage, there is no need to convert it to an image. Here is an example on how to embed the chart directly into the page: https://github.com/kMutagene/Plotly.NET.BlazorSample/tree/main/PlotlyBlazorTest

from plotly.net.

markus-renezeder avatar markus-renezeder commented on June 11, 2024

Hi @kMutagene ,
thank you for your answer. I've got it running by setting the chromium executable. This works on my local dev machine.

But I'm wondering how to use this function if I host the Blazor application in a docker container or on a web server. In this case mabe I don't have a local chromium installation.

Is there a possibility to use the .SaveJPG method without the need of a local installed application (maybe a rendere which can be installed using nuget)?

The reason why I need to export it to an image is that I want to provide an API which creates the image. This image should be displayed in different documents like HML-Page, PDF ...

from plotly.net.

kMutagene avatar kMutagene commented on June 11, 2024

I think your best bet is shipping the needed binaries bundled with your application. For a docker container that could either involve a custom image that contains the binaries, or using a base image that has chromium pre-installed. If you just deploy the application itself, maybe bundling the necessary binaries into the publish output will work.

However, you will currently not get around needing chromium for this though. Plotly.NET creates chart objects that can be rendered by plotly.js - which needs a JS runtime to work. There are other ways we could do this, see e.g. #393 or #422 . I think playwright-dotnet is packaging the browser binaries in it's nuget package, so it seems to be possible doing it like that - but both these approaches are not implemented. The only reference implementation for static image export currently available in Plotly.NET.ImageExport uses PuppeteerSharp which either downloads the latest chromium or needs a local installation.

from plotly.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.