gpt4 book ai didi

javascript - Highstock dateTimeLabelFormats 不起作用

转载 作者:行者123 更新时间:2023-11-30 17:22:32 26 4
gpt4 key购买 nike

我试图在 Xaxis 中仅显示该月的第一天,一切正常系列数组有超过或等于五个元素:

http://jsfiddle.net/2f6Ne/

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 ]
]

有什么想法吗?

最佳答案

虽然我不确定你在问什么,但我是否隐约猜到你想在 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;
}

http://jsfiddle.net/2f6Ne/2/ http://jsfiddle.net/XtFnx/3/

关于javascript - Highstock dateTimeLabelFormats 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24871061/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com