您可以手动设置exporting.buttons.contextButton.menuItems
(API http://api.highcharts.com/highcharts#exporting.buttons.contextButton.menuItems)以包含您想要的任何按钮。
您需要将其设置为仅包含 JPG 和 PNG 像这样(简短形式,textKey
only):
menuItems: ['downloadPNG','downloadJPEG']
或者对于更明确的函数调用(带有对象和的长形式)onclick
):
menuItems: [{
textKey: 'downloadPNG',
onclick: function () {
this.exportChart();
}
}, {
textKey: 'downloadJPEG',
onclick: function () {
this.exportChart({
type: 'image/jpeg'
});
}
}]
正如这些 JSFiddle 演示中所示:简写 https://jsfiddle.net/a9bvusny/ and 长表 https://jsfiddle.net/h97xk1v3/.
默认为exporting.js
is:
menuItems: [{
textKey: 'printChart',
onclick: function () {
this.print();
}
}, {
separator: true
}, {
textKey: 'downloadPNG',
onclick: function () {
this.exportChart();
}
}, {
textKey: 'downloadJPEG',
onclick: function () {
this.exportChart({
type: 'image/jpeg'
});
}
}, {
textKey: 'downloadPDF',
onclick: function () {
this.exportChart({
type: 'application/pdf'
});
}
}, {
textKey: 'downloadSVG',
onclick: function () {
this.exportChart({
type: 'image/svg+xml'
});
}
}]
额外的export-data.js
are:
menuItems: [{
textKey: 'downloadCSV',
onclick: function () {
this.downloadCSV();
}
}, {
textKey: 'downloadXLS',
onclick: function () {
this.downloadXLS();
}
},{
textKey: 'viewData',
onclick: function () {
this.viewData();
}
},{
textKey: 'openInCloud',
onclick: function () {
this.openInCloud();
}
}]