我试图仅在Xaxis中显示该月的第一天,一切都很好 系列数组有多于或等于五个元素:
data: [
[ Date.UTC(2014, 0, 1), 10.82413772161932 ],
[ Date.UTC(2014, 1, 1), 0.10286926951274679 ],
[ Date.UTC(2014, 2, 1), 0.4359489916094994 ],
[ Date.UTC(2014, 3, 1), 0.4359489916094994 ],
[ Date.UTC(2014, 4, 1), 0.4359489916094994 ]
]
但是当系列少于五个元素时,dateTimeLabelFormats选项不起作用: http://jsfiddle.net/XtFnx/
data: [
[ Date.UTC(2014, 0, 1), 10.82413772161932 ],
[ Date.UTC(2014, 1, 1), 0.10286926951274679 ],
[ Date.UTC(2014, 2, 1), 0.4359489916094994 ],
[ Date.UTC(2014, 3, 1), 0.4359489916094994 ]
]
有什么想法吗?
答案 0 :(得分:2)
虽然我不确定你在问什么,但我含糊地猜到你想在x轴上每个月首先显示。如果是,你可以使用tickPositioner。
tickPositioner: function() {
var ticks = [
Date.UTC(2014, 0, 1),
Date.UTC(2014, 1, 1),
Date.UTC(2014, 2, 1),
Date.UTC(2014, 3, 1)];
//dates.info defines what to show in labels
//apparently dateTimeLabelFormats is always ignored when specifying tickPosistioner
ticks.info = {
//unitName: "month",
unitName: "day",
higherRanks: {} // Omitting this would break things
};
return ticks;
}
答案 1 :(得分:0)
按预期工作:您已更改月/年选项,但所有其他选项(日,小时等)均用作默认值。 dateTimeLabelFormats不会阻止在xAxis上显示不同的间隔。要更改使用minTickInterval。