1
我“米工作类似于以下http://jsfiddle.net/7FdQR/1/ignoreHiddenSeries没有在X轴隐藏值,如果显示的系列有空数据
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -100,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'Total: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: [{
name: 'John',
data: [null, 3, 7, 2, null]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
});
})一highchart;
如果你看一下数据对于John,你会看到一些苹果和香蕉的空值。
如果我们禁用Jane和Joe系列,只留下John的信息,我们仍然可以看到x轴上的所有水果类别,即使有空值约翰的数据集和ignoreHiddenSeri es设置为true。我想在这里实现的是将x轴重新绘制为仅显示橘子,梨和葡萄标签(而不是在x轴上的苹果和香蕉标签)。有没有办法在highchart中做到这一点?
谢谢!