Sr270
Posts: 83
Joined: Tue Aug 23, 2022 12:15 pm

Export only charts that are selected

I display multiple charts on a page. How do I export only the charts that are selected(checked) and displayed on screen.
Fiddle:https://jsfiddle.net/v1ncrywb/39/

For eg: out of five charts, If I only select, chart1 and chart2, only those 2 charts need to be exported. Other charts should not be included.

In the below example,
- If I had selected only chartEp0, chartEp1, it still prints chartEp2 along.

function exportCharts() {
console.log("entered func export");
Highcharts.exportCharts([chartEp0, chartEp1, chartEp2]);
}

- Wheras, adding chartEp3, chartEp4 does not allow exporting. Since chartEp3, chartEp4 does not satisfy if condition if (chart4 === "chart44"){}, says "Failed to get SVG" on console.

function exportCharts() {
console.log("entered func export");
Highcharts.exportCharts([chartEp0, chartEp1, chartEp2, chartEp3, chartEp4]);
}

Thank you.
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: Export only charts that are selected

Hello,

Thanks for contacting us!

Your problem has little to do with Highcharts itself. You need to use native JS to achieve what you need.

Demo: https://jsfiddle.net/BlackLabel/wjgf5z7s/

I hope you will find it useful
Regards
Dawid Draguła
Highcharts Developer
Sr270
Posts: 83
Joined: Tue Aug 23, 2022 12:15 pm

Re: Export only charts that are selected

That was really helpful. Thank you.
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: Export only charts that are selected

You're welcome!
Regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Usage”