vlastoun
Posts: 2
Joined: Fri Jun 25, 2021 3:17 pm

Render directly to SVG

Hello! Is there possibility to render chart directly to SVG without actually rendering it to any div?

Code: Select all

const chart = Highcharts.chart(...some options)
const svg = chart.getSVG()
This fails because I have no container specified.

I am using react for this project and I am able to get it with
highcharts-react-official
I am able to get some sag data but I have to render chart. I do not want to render chart because I just want to attach it into PDF.

Is it somehow possible or not?
Thank you
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Render directly to SVG

Hi Welcome to the official highcharts forum, and thanks for contacting us with your question! I don't really understand how you want to do it, but here is the api reference: https://api.highcharts.com/class-refere ... art#getSVG

and here is the demo, where this function is used: https://jsfiddle.net/gh/get/library/pur ... rt-getsvg/

let me know, if that works for you! Kind regards,
Paweł Lysy
Highcharts Developer
vlastoun
Posts: 2
Joined: Fri Jun 25, 2021 3:17 pm

Re: Render directly to SVG

Thank you for answer..
I want to use it without rendering chart to <div id="container" . I want to export svg based on data.
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Render directly to SVG

Hi again! Another way, is to use the export server. https://export.highcharts.com/

https://www.highcharts.com/docs/export- ... 1623046255

here is the documentation. Let me know, if that works for you! In case of any further questions feel free to contact us again! Kind regards,
Paweł Lysy
Highcharts Developer
ashishjadhav5687
Posts: 1
Joined: Wed Jan 19, 2022 12:37 pm

Re: Render directly to SVG

Can you share source code for above examples

https://export.highcharts.com/
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Render directly to SVG

Hi ashishjadhav5687,

Welcome to our forum and thanks for contacting us with your question!

I'm not quite sure if that is what you're looking for, but in previous post my collegaue suggested using client side export, or in other words offline exporting module. As you can see in this demo, it requires two modules: exporting and offline-exporting. You can find their source code direcly under our CDN links:
Exporting module:https://code.highcharts.com/modules/exporting.src.js
Offline-exporting module: https://code.highcharts.com/modules/off ... ing.src.js

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”