2

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/

Alex
  • 5,674
  • 7
  • 42
  • 65
  • Only what comes to my mind is use tickPositioner which allows to define irrerugalr ticks, (in your example it will be function which define ticks for year data and day data). http://api.highcharts.com/highstock#xAxis.tickPositioner – Sebastian Bochan May 20 '13 at 13:30
  • Duplicate? http://stackoverflow.com/questions/13438937/highstock-highcharts-irregular-data-gets-wrong-x-scale/13439281#13439281 – Jugal Thakkar May 20 '13 at 16:41

1 Answers1

2

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

Paweł Fus
  • 44,795
  • 3
  • 61
  • 77