Add timeseries to queries

I need to use timeseries queries, which add 0s according to the query granularity when there is no value in the data.

I have a working unit test, I believe this code is ready to merge.