我试图向我的用户显示每个摄像机每天录制的视频数量。为此,我想使用堆叠背面(每个堆栈显示使用给定摄像机记录的视频数量)。以下是我传递的选项:
var options = {
"title": {
"text": null
},
"legend": {
"layout": "vertical",
"style": { },
"enabled": false
},
"xAxis": {
"type": "datetime",
"minTickInterval": 86400000
},
"yAxis": {
"stackLabels": { "enabled": true },
"title": { "text": null }
},
"tooltip": { "enabled": true },
"credits": { "enabled": false },
"plotOptions": {
"column": { "stacking": "normal" }
},
"chart": {
"defaultSeriesType": "column",
"height": 200,
"borderRadius": 0,
"renderTo": "monthy_chart"
},
"subtitle": { },
"colors": [ "#c7084b","#089fbf","#00d047","#d300d1","#f48400","#f6f400" ],
"series": [
{
"name": "Camera",
"data": [ [ 1362614400000,6 ],[ 1362528000000,2 ] ]
},
{
"name": "NewCamera2",
"data": [ [ 1362614400000,1 ] ]
}
]
};
图表正确显示数据,但即使只有2天的数据(下图),也会极其严格地呈现列。有没有办法让我定义x轴的比例,这样列的宽度会显示得更好?
答案 0 :(得分:3)
您可以设置pointWidth和startOnTick / endOfTick
"xAxis": {
startOnTick:true,
endOnTick:true,
"type": "datetime",
"minTickInterval": 86400000
http://api.highcharts.com/highcharts#xAxis.startOnTick http://api.highcharts.com/highcharts#xAxis.endOnTick http://api.highcharts.com/highcharts#plotOptions.column.pointWidth