从高级图表上下文菜单中删除视图数据表

时间:2019-07-18 07:35:05

标签: javascript java highcharts wicket

我需要从高级图表上下文菜单中删除“查看数据表”选项。我在流程页面的一个堆栈中找到了2个解决方案。     solution1正在为我工​​作。但是solution2无法正常工作。在我的代码中,我只需要使用solution2。

Stack overflow page link

try {  
String solution1 = "function(chart) {"
                        + "var arr = 
Highcharts.defaultOptions.exporting.buttons.contextButton.menuItems;"
                        + "var index = arr.indexOf('viewData');"
                        + "if (index !== -1) arr.splice(index, 1);}";

                String solution2 = "exporting: {buttons: {contextButton: {menuItems: ['printChart','separator','downloadPNG','downloadJPEG','downloadPDF','downloadSVG','separator','downloadCSV','downloadXLS','openInCloud']}}}";
                String js = MessageFormat
                        .format("Highcharts.chart('chartview',{0});", data
                                .processChartData().toString() + "," + solution2);
                response.render(OnDomReadyHeaderItem.forScript(js));
}

0 个答案:

没有答案