我想顯示從1月至12月的月份,但系列數據是穩定的。發生了什麼事情是,僅在圖表中顯示的月份是從1月到5月。我將如何做到這一點?請參閱以下代碼,Highcharts類別月份不添加
function getchart2()
{
$('#container2').highcharts({
chart: {
type: 'column',
renderTo: 'container'
},
title: {
text: 'Daily Events',
style: {
'color': '#06F',
'font-family': 'Roboto',
'font-size': '16px',
'font-weight': 'bold'
},
useHTML: true
},
xAxis: {
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
],
crosshair: true
},
yAxis: {
min: 0,
title: {
text: 'No. of Events'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
itemStyle: {
'color': '#666',
'font-family': 'Roboto',
'font-weight': 'normal',
'font-size': '11px'
},
useHTML: true
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y;
}
},
plotOptions: {
column: {
pointWidth: 30,
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
style: {
textShadow: '0 0 3px black'
}
}
}
},
series: [{
name: 'Incoming',
data: [
{y: 10.4, color: '#FAA961'}, //incoming
{y: 15.4, color: '#FAA961'},
{y: 20.4, color: '#FAA961'},
{y: 12.4, color: '#FAA961'},
{y: 30.4, color: '#FAA961'},
],
color: '#FAA961'
}, {
name: 'Ongoing',
data: [
{y: 10.4, color: '#438EF7'}, //incoming
{y: 15.4, color: '#438EF7'},
{y: 20.4, color: '#438EF7'},
{y: 12.4, color: '#438EF7'},
{y: 30.4, color: '#438EF7'},
],
color: '#438EF7'
}, {
name: 'Finished',
data: [
{y: 34.4, color: '#43F752'}, //incoming
{y: 35.4, color: '#43F752'},
{y: 40.4, color: '#43F752'},
{y: 42.4, color: '#43F752'},
{y: 20.4, color: '#43F752'},
],
color: '#43F752'
}]
});
}
的[Highcharts分類不添加]可能的複製(http://stackoverflow.com/questions/36174196/highcharts-categories-dont-加) – dgw