我的例子:enter code here
http://jsfiddle.net/8wkyu9hh/
end-Data point应该是2020年12月。但它显示的是1月-2021.当设置endOnTick:true时,sep 2020当endOnTick:false时。 如何解决它。
答案 0 :(得分:0)
它不会显示2020年12月,因为您每隔三个月就会在xAxis上显示(Jan - > Apr - > July - > Oct - > Jun)。我会升级你的tickPositioner
。另外,我会更改min
和max
以使用Date.UTC()
,但这只是个人观点。
tickPositioner: function (min, max) {
var axis = this,
options = axis.options,
// get normalized tick interval
normalizedTickInterval = axis.normalizeTimeTickInterval(
axis.tickInterval,
options.units),
// get default ticks
ticks = this.getTimeTicks(
normalizedTickInterval,
min,
max,
options.startOfWeek,
axis.ordinalPositions,
axis.closestPointRange,
true);
// register information for label formatter
ticks.info = {
higherRanks: normalizedTickInterval.higherRanks,
unitName: normalizedTickInterval.unitName
};
// replace first label with 2004 year. When label overlap, remove for example first two elements (1 change to 2):
//ticks.splice(0, 2, min);
ticks.splice(0, 1);
ticks.push(max);
ticks.sort(function (a, b) {
return a - b;
});
return ticks;
}