Question

I'm looking to programmatically enable exporting of all charts on a page.

Here's my current code:

$('.js-chart-export').on('click', function(e){
    e.preventDefault();
    charts = $('.chart').highcharts();
    charts.options.exporting.enabled = true;
});

.js-chart-export is a link that I'd like to be able to click to add the exporting button to all the charts. Each chart container has a class of .chart.

What Else I've Tried

There are a number of document ready's that have the original highchart calls. Experimenting with one, I called a chart such that the object was global (confirmed via console) and tried calling:

specific_chart.options.exporting.enabled = true;

Within that chart's object, the values changed but the button wasn't added to the chart. Next, I tried calling the redraw() function but that approach failed as well. Any ideas?

Était-ce utile?

La solution

Unfortuantely you cannot dynamically do this, you need to destroy and create new chart.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top