Discontinuous dataset in highcharts

喜你入骨 提交于 2019-12-02 17:04:11

问题


These are the two types of datasets I am trying to load and there are many more as per the dropdown combinations. These are 14 days datasets ( also at an hourly level for 14*24 hours) The 2 types of datasets are :

1 (continuous)

7/8/2014 0:00   9442
7/9/2014 0:00   8492
7/10/2014 0:00  9491
7/11/2014 0:00  9697
7/12/2014 0:00  7377
7/13/2014 0:00  8206
7/14/2014 0:00  9586
7/15/2014 0:00  10855
7/16/2014 0:00  9693
7/17/2014 0:00  11682
7/18/2014 0:00  9668

2 (discontinuous)

7/11/2014 0:00  1
7/16/2014 0:00  1

OR

7/9/2014 0:00   1
7/10/2014 0:00  18
7/11/2014 0:00  2
7/14/2014 0:00  2
7/15/2014 0:00  4
7/16/2014 0:00  1
7/17/2014 0:00  1
7/18/2014 0:00  4

The problem lies in the #2 part of datasets. For eg, in the first example the display is :

As we can see, the x-axis is wrong here and the tooltip is correct. This is happening for all type #2 datasets.

After reading about this issue, I tried setting ordinal to false, but somehow even that is not helping here. why is this happening? Ordinal should make it work from what I read as far.

Code snippet :

xAxis: {
            ordinal : false,
            type : 'datetime',
            min : Date.UTC(new Date(processed_json[0][0]).getYear(),new Date(processed_json[0][0]).getMonth(),new Date(processed_json[0][0]).getDate()),
            max : Date.UTC(new Date(processed_json[processed_json.length - 1][0]).getYear(),new Date(processed_json[processed_json.length - 1][0]).getMonth(),new Date(processed_json[processed_json.length - 1][0]).getDate())

}

what are the changes I need to make here to make it work within my code? why is ordinal not working?

All approaches/suggestions are most welcome here

来源:https://stackoverflow.com/questions/25861690/discontinuous-dataset-in-highcharts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!