Highcharts:如何获取图表上的默认导出选项?

cur*_*us1 2 highcharts

我在项目中使用Highcharts.我使用以下内容隐藏图表导出选项的默认下拉列表:

$('#mycontainer").highcharts({
   ...
   chart: {
      type: 'column'
   },
   exporting: {
     enabled: false
   }
   ..
});
Run Code Online (Sandbox Code Playgroud)

但是,我确实需要这些导出选项,我需要将它们与其他东西一起放在我自己的菜单中.如果我是对的,单个图表上的默认导出选项基本上是在客户端Javascript驱动的,与服务器无关.

如何重建这些导出选项并将它们放在javascript中?

UPDATE

exports.js已包含在我的页面中,但我想禁用它生成的默认导出下拉列表,并将默认下拉导出选项移动到我自己的菜单中.我需要知道默认下拉选项链接或javascript是什么,以便我可以使我的菜单工作方式与默认导出下拉列表相同.

感谢致敬.

Hal*_*and 8

默认导出选项是(直接来自exports.src.js):

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'
        });
    }
}
// Enable this block to add "View SVG" to the dropdown menu
/*
,{

    text: 'View SVG',
    onclick: function () {
        var svg = this.getSVG()
            .replace(/</g, '\n&lt;')
            .replace(/>/g, '&gt;');

        doc.body.innerHTML = '<pre>' + svg + '</pre>';
    }
} // */
]
Run Code Online (Sandbox Code Playgroud)

这里this是指图表本身,因此您可以将其替换为您的chart变量.

例如,JPEG导出:

var chart = $('#container').highcharts();
chart.exportChart({
    type: 'image/jpeg'
});
Run Code Online (Sandbox Code Playgroud)

或者看看这个JSFiddle演示.