有一个可靠的方法来使用高图表有一个月的自动生成的时间间隔? [英] Is there a reliable way to have a 1 month auto generated tick interval with high charts?

查看:149
本文介绍了有一个可靠的方法来使用高图表有一个月的自动生成的时间间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

高图表有一个非常好的方法来为图表生成日期。然而,由于你需要指定一个tickInterval来为每个点生成日期,所以每1个月的时间间隔是非常困难的,因为它们是不规则的。

推荐的方法是使用等于31天的时间间隔,但是有许多2月会跳过的用例。



有一个可靠的方法可以让一个月的自动生成的时间间隔与高图表一起进行吗?

解决方案

看起来像不规则区间数据提供的例子可以解决您的问题: Highcharts演示 - 不规则时间间隔

从这个例子中,用于x轴标签的相关代码是:

  xAxis:{
type:' datetime',
dateTimeLabelFormats:{//不显示虚拟年份
month:'%e。 %b',
year:'%b'
}
},


High charts has a really nice way to generate dates for charts.

However since you need to specify a tickInterval to use generate the dates for each point, doing 1 month intervals is very difficult since they are irregular.

The recommended approach is to use a tick interval equal to 31 days, but there are a number of use cases where February gets skipped.

Is there a reliable way to have a 1 month auto generated tick interval with high charts ?

解决方案

Seems like the example provided for irregular interval data would solve your problem: Highcharts Demo - Irregular Time Interval

The relevant code, from that example, for x-axis labeling is:

xAxis: {
   type: 'datetime',
   dateTimeLabelFormats: { // don't display the dummy year
      month: '%e. %b',
      year: '%b'
   }
},

这篇关于有一个可靠的方法来使用高图表有一个月的自动生成的时间间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆