문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top