我有一种情况,我试图让X轴类别值显示在HighCharts图表中,并在每个' bin的中心排列。在x轴上。它似乎使用文字"类别"在x轴上是问题的一部分。有一个简单的方法吗?
以下是我的选项的json.stringified版本和屏幕截图的示例:
Highcharts.chart('container', {
"chart":{
"renderTo":"",
"zoomType":"xy",
"alignTicks":false,
"animation":false,
"height":600,
"type":"line",
"backgroundColor":"#fff",
"resetZoomButton":{
"theme":{
"fill":"white",
"stroke":"silver",
"r":0,
"states":{
"hover":{
"fill":"#7ac142",
"style":{
"color":"white"
}
}
}
}
},
"options3d":"",
"panning":true,
"panKey":"shift"
},
title: {
text: 'Step line types, with null values in the series'
},
xAxis:{
"align":"left",
"categories":[
"0:00",
"1:00",
"2:00",
"3:00",
"4:00",
"5:00",
"6:00",
"7:00",
"8:00",
"9:00",
"10:00",
"11:00",
"12:00",
"13:00",
"14:00",
"15:00",
"16:00",
"17:00",
"18:00",
"19:00",
"20:00",
"21:00",
"22:00",
"23:00"
],
"title":{
"text":"",
"style":{
"color":"#3E576F",
"font-family":"Verdana",
"font-size":"12px"
}
}
},
"series":[
{
"data":[
72.2,
71.5,
71.7,
71.2,
73.6,
73.5,
72,
71.4,
69.7,
70.8,
70.9,
71.3,
72,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"name":"The Data",
"color":"#1AC8ED"
},
],
});
答案 0 :(得分:0)
可以使用tickmarkPlacement
option进行设置。对于分类轴,默认为between
,而其他轴为on
。您需要将其设置为on
。
例如(JSFiddle):
xAxis:{
tickmarkPlacement: 'on'
// ...
}