Highcharts在重置时自定义导出隐藏

时间:2015-06-18 23:55:14

标签: javascript jquery highcharts

我正面临着高等问题的一个问题。

我有这个代码,它提供自定义下载而不是highcharts默认打印和下载:

    $('#container').highcharts({
    exporting: {
                            buttons: {
                                contextButton: {
                                    enabled: false
                                },
                                exportButton: {
                                    text: 'Download',
                                    y:30,
                                    //x: 1,
                                    //y: 5,
                                    // Use only the download related menu items from the default context button
                                    menuItems: Highcharts.getOptions().exporting.buttons.contextButton.menuItems.splice(2)
                                },
                                printButton: {
                                    text: 'Print',
                                    y: 30,
                                    onclick: function () {
                                        this.print();
                                    }
                                }
                            }
                        }
       });

这个代码在我调用一次时工作正常,但是当我再次调用它而不刷新页面时,下载按钮并没有显示所有选项,例如下载为pdf,下载为图像等。

任何帮助?

感谢。

1 个答案:

答案 0 :(得分:2)

那条线是罪魁祸首:

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Highcharts.getOptions().exporting.buttons.contextButton.menuItems.splice(2) 修改数组。所以在第一次通话后,splice并不相同。因此请改用menuItems

slice()
相关问题