statistics - plot regular graph when x axis data is inconsistent -


as example, have api access sensor measures how many lumens of light there outside. ideally want access every hour on hour can plot graph data like:

datetime        | lumens 2015-05-12 0900 | 9001 2015-05-12 1000 | 11400 2015-05-12 1100 | 11300 2015-05-12 1200 | 18000 

unfortunately api call, various reasons such internet connectivity , device tragically running solar power, intermittent. ideally device store data until has been collected, alas returns data @ moment has been asked:

datetime        | lumens 2015-05-12 0905 | 9006 2015-05-12 1123 | 11900 2015-05-12 1201 | 18026 

which holey, , late. assuming have work data , create graphs it, there several options.

  • use scattergraph, type of graph account irregularity of data collected
  • interpolate data estimate have been, on hour

because want line graph doing equivalent of plotting results many sensors, inclined towards interpolated regularity.

my questions is:

if (does problem have name)   it, can else   if (are there better ways of solving this, instead of interpolating regularity)     they?   else (ie nope best one)     there more optimum solution following algorithm   end end  

interpolated regularity pseudocode. (in pseudocode, on stack first , pop both @ earliest value in array)

dataset = dataset irregularly spaced readings results = empty array first_datetime = select earliest datetime , select first hour following (e.g. '2015-05-12 0905' => '2015-05-12 1000')  last_datetime = select latest datetime , select first hour preceeding (e.g. '2015-05-12 1201' => '2015-05-12 1200')  result_dates = array of every hour between first_datetime , last_datetime (e.g. ['2015-05-12 1000','2015-05-12 1100','2015-05-12 1200']) stack = dataset sorted earliest first popped , latest last popped cached_earliest = stack.pop (e.g. '2015-05-12 0905' => 9006) each 'result_date' in result_dates   while stack.first < result_date     cached_earliest = stack.pop   end   results << result_date , interpolation of result_date's value between cached_earliest , stack.first (e.g. working out value time '1000' between '0905'=>9006 , '1123'=>11900 ((9006*((138-55)/138))+(11900*((138-83)/138))) = ~10159, gap between times 138 minutes) end 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -