Alex
Alex

Reputation: 5724

Highstock Time series with uneven data set distrubition

I have a time series, that for 1 day has live data. ( eg minute to minute ticks ) It also however, has historic time data going back ~ 5 or so years.

If I zoom out on the chart, because I have say... 500 points today, and 500 points over the rest of the period I am covering, the chart behaves weirdly:

  1. 50% of the chart is taken up by a single day.

I am expecting the chart to take that day, and scale it away, so that if I am viewing a years worth of data, the day only represents 1/365 ths of a chart, instead of ( what it seems to be doing ) ticks for that day/total amount of ticks

EG data sets:

for(var i=0; i< 15; i++){ // push 15 records going back an hour each
    data.push([ new Date().getTime() - 1000*60*60*i , (Math.floor(2*Math.random())) % 3 + 1])
}
for(var i=1; i< 21; i++){ // push 20 records going back a month each
    data.push([ new Date().getTime() - 1000*60*60*24*7*30*i , (Math.floor(2*Math.random())) % 3 + 3])
}

so with this data, I get 15+20 = 35 //total ticks

and the % used by one day is 15/35 = ~42% Whereas I would expect it to represent ( in terms of % of chart area )

20*30*24 =14400 //total amount of hours represented by months going backwards
15/14400 = ~1% //  hours with fine ticks / total hours -- WHY IS IT NOT THIS?

If you zoom past that day, the distribution is how one would expect it though (zoom is over full period )

See fiddle for rough example: http://jsfiddle.net/K6nUv/3/

Upvotes: 2

Views: 625

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Try to set ordinal for xAxis to false: http://jsfiddle.net/K6nUv/4/

Upvotes: 2

Related Questions