答案 0 :(得分:1)
默认情况下,Highharts不支持此行为,但是您可以轻松地包装init
方法,并根据系列可见性设置showInLegend
选项进行导出:
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function(proceed, options, callback) {
if (options.chart && options.chart.forExport && options.series) {
$.each(options.series, function() {
if (this.visible === false) {
this.showInLegend = false;
}
});
}
return proceed.call(this, options, callback);
});
实时演示:http://jsfiddle.net/BlackLabel/x2gy7f0q/
文档:https://www.highcharts.com/docs/extending-highcharts/extending-highcharts