Megapolis
Posts: 1
Joined: Fri May 13, 2022 8:48 am

Exporting hidden Columns with getSVG

Good Day!

Is it possible using the chart.getSVG method to export all columns and even those that have been hidden by the user?

My sandbox: https://codesandbox.io/s/highcharts-rea ... ked-rfopj0

For example, if I hide Series 1 and Series 2 and click the "EXPORT AND INSERT SVG" button, I want all 3 columns to be exported, not just one.

I tried to add this code, but now I get bugs when I try to hide/show columns. As I understand it, I shouldn't mutate chart.series but I don't know how to get around it.

const exportSVG = () => {
const series = [...chartRef.current.chart.series].map(
(item) => (item.visible = true)
);
const exportedSvg = chartRef.current.chart.getSVG();
setSvg(exportedSvg);
};


I will be very grateful for your advice.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Exporting hidden Columns with getSVG

Hello,

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

You can use chart.renderer.forExport flag to check if this is exporting version and show all invisible series.
Demo: https://codesandbox.io/s/highcharts-rea ... =/demo.jsx

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Usage”