我有fiddle code
http://jsfiddle.net/c4Zd8/14/我在其中使用了hide系列数据的hide选项,其中包含highcahrts中的以下代码
series: {
events: {
legendItemClick: function(event) {
var selected = this.index;
var allSeries = this.chart.series;
$.each(allSeries, function(index, series) {
if (selected == index) {
if (series.visible == true) {
series.hide();
}
else {
series.show();
}
}
});
return false;
}
}
}
如何将相同的逻辑用于类别。像jan,feb? 请指导。
答案 0 :(得分:0)
请参阅API highcharts doc http://api.highcharts.com/highcharts#Axis.setCategories
$('#button').click(function() {
var chart = $('#container').highcharts();
chart.xAxis[0].setCategories(['asd', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
});