I'm not sure where you get printButton , but here's how you do it. You create the Highcharts.setOptions javascript block and add the exporting code:
Highcharts.setOptions({ global: { useUTC: false }, exporting: { buttons: { contextButton: { menuItems: [{ text: 'Export to PNG (small)', onclick: function() { this.exportChart({ width: 250 }); } }, { text: 'Export to PNG (large)', onclick: function() { this.exportChart(); }, separator: false }] } } } });
This creates only two export buttons. To change the type of export, please raise the exportChart() code. Then you have the chart code below the page. I would not put setOptions in the section of the finished document. I would put your actual schedule in the document ready. Work fiddle .
Option 2 Suppose you know that the default export menu items will always be in the order in which they are now. Then you can get the export menu items:
var theExportOptions = Highcharts.getOptions().exporting.buttons.contextButton.menuItems;
Now delete the "Print" section:
theExportOptions.splice(0, 1);
Close, but we still have a weird divider. So now delete it:
theExportOptions.splice(0, 2);
It seems OK. But you have to put this bit of code in javascript before loading any chart. I don't like this option because you depend on HighCharts, always having the same order / number of export options.
wergeld
source share