本文介绍了Highcharts-具有日期时间值的TickInterval的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从highcharts文档中: http://api.highcharts.com/highstock#xAxis.tickAmount

From the highcharts docs : http://api.highcharts.com/highstock#xAxis.tickAmount

我可以看到tickInterval不适用于日期时间轴,所以我的问题是,是否存在一种解决方法来设置xAxis中的刻度标签数量?

I can see tickInterval is not avilible for datetime axis, So my question is, is there a workaround to set the number of ticks labels in my xAxis?

我尝试玩了一段时间,直到现在都没有成功.

I tried to play with it for a while, till now no success.

推荐答案

此答案是假设您确实要tickInterval而不是tickAmount.

This answer is assuming you indeed want tickInterval and not tickAmount.

我已经成功地将tickInterval用于datetime轴.这完全取决于您希望每个刻度线之间有多少时间.

I've successfully used tickInterval for datetime axes. It all depends on how much time you want between each tick mark.

例如,如果要显示每个日历年的刻度,则可以执行以下操作:

For example, if you want to display a tick for each calendar year, you could do the following:

tickInterval: 1000 * 60 * 60 * 24 * 365
// milliseconds * seconds * minutes * hours * days = 1 year

我希望这会有所帮助!

这篇关于Highcharts-具有日期时间值的TickInterval的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 06:40