简体   繁体   English

列范围图中的多个时间间隔

[英]Multiple intervals in columnrange chart Highcharts

Im trying to create a columnrange chart with several categories displaying an interval during a year. 我试图创建一个列范围图表,其中有多个类别显示一年中的间隔。 It all works fine, however, Im now stuck with the problem that for one of the categories, I need two intervals on the same row. 一切正常,但是,我现在遇到了以下问题:对于其中一个类别,我需要在同一行上放置两个间隔。

So, for example, in the fiddle attached below, I have each category as from-to months. 因此,例如,在下面所附的小提琴中,我将每个类别的起始日期设置为几个月。

Eg: 例如:

category 1: Mar->Jun 类别1:3月-> 6月

category 2: July->Aug 类别2:7月-> 8月

etc. 等等

But now Im stuck with eg this: 但是现在我坚持这样:

categoty 3: Mar->Jun, Sep->Oct 类别3:3月-> 6月,9月-> 10月

Here is the fiddle: http://jsfiddle.net/t9rsf6n7/1/ 这是小提琴: http : //jsfiddle.net/t9rsf6n7/1/

series: [
                {
                    name: '',
                    color: '#795548',
                    data: [
                        {
            low:Date.UTC(2017,1,1),
            high:Date.UTC(2017,3,31),
            color:'#ffae3d'
          },
          {
            low:Date.UTC(2017,2,1),
            high:Date.UTC(2017,4,30),
            color:'#ff3d3d'
          }                     ]
                }
            ]

Any help is really appreciated. 任何帮助都非常感谢。

Set the x value for each data point, and for your 2 points in category 3, they'll both have the same x value. 为每个数据点设置x值,对于类别3中的2个点,它们都将具有相同的x值。

    series: [
    {
        name: '',
        color: '#795548',
        data: [
          {
            x:0,
            low:Date.UTC(2017,1,1),
            high:Date.UTC(2017,3,31),
            color:'#ffae3d'
          },
          {
            x:1,
            low:Date.UTC(2017,2,1),
            high:Date.UTC(2017,4,30),
            color:'#ff3d3d'
          },
                        {
            x:2,
            low:Date.UTC(2017,2,1),
            high:Date.UTC(2017,5,30),
            color:'#3d3dff'
          },
                        {
            x:2,
            low:Date.UTC(2017,8,1),
            high:Date.UTC(2017,9,30),
            color:'#3d3dff'
          },
        ]
    }]

http://jsfiddle.net/t9rsf6n7/2/ http://jsfiddle.net/t9rsf6n7/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM