Skip to content

Export Chart to SVG/PNG #90

Description

@LucasNmn

Hi,
is there an easy way to export a plotted chart directly from code as PNG or SVG?
I tried it using the ".toChartImage" function from the api but didn't find a working solution yet.

Activity

  1. kMutagene commented on Jun 24, 2021

    @kMutagene
    Collaborator

    To export charts created with Plotly.NET directly as an image file, you need some kind of headless browser to do the javascript execution to render the chart first. There is a package out there using Pupeteer for that which might work for you, check #21 for that. However, there is an in-house solution by plotly which we still need to wrap for .NET use - It is on the roadmap but not quite here yet.

    Related/possible duplicates: #21 and #65.

  2. LucasNmn commented on Jun 24, 2021

    @LucasNmn
    Author

    Thanks for your advice,
    I will test that.

  3. kMutagene commented on Jul 12, 2021

    @kMutagene
    Collaborator

    closed via #94. @LucasNmn if you have time and interest you might check out the docs for the new Plotly.NET.ImageExport package here.

  4. LucasNmn commented on Jul 12, 2021

    @LucasNmn
    Author

    I'm having problems getting the function to work in C#. SaveJPG seems to be unknown while I'm using Preview 6. But I already made my own workaround with Pupperteer as you mentioned in #21 and #65 .

  5. kMutagene commented on Jul 12, 2021

    @kMutagene
    Collaborator

    Thanks for checking it out, i will test this in C# now to see if there's an issue.

    Just to be clear, Plotly.NET.ImageExport is a separate nuget package: https://www.nuget.org/packages/Plotly.NET.ImageExport/. Maybe i should add this to the docs. If you want access to .SaveJP you also have to open the GenericChartExtensions namespace.

    But if you have an approach that works for you already, thats just as fine.

  6. LucasNmn commented on Jul 12, 2021

    @LucasNmn
    Author

    Thanks for checking it out, i will test this in C# now to see if there's an issue.

    Just to be clear, Plotly.NET.ImageExport is a separate nuget package: https://www.nuget.org/packages/Plotly.NET.ImageExport/. Maybe i should add this to the docs. If you want access to .SaveJP you also have to open the GenericChartExtensions namespace.

    But if you have an approach that works for you already, thats just as fine.

    Thanks for that. I thought it was inside the same package. X)
    It's working now. But I have to fix authorization problems with my proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MissingAbstractionPlotly.js functionality that has to be implemented

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions