At the very basic level you are producing a timechart with a span=1h and you want a time chart with a daily set of numbers, so that's wrong. However, it's impossible to say what is going on here, you have so much going on in the search. You have to go back to basics, which means start with the basic data and at EACH step of your SPL make sure the data is giving you what you expect. So, take a very small sample set of data and run the SPL line by line, check the output after each line. When you are happy that the data is giving you the correct output from 1 line of SPL, add in the next line.
... View more