I have a few items that are updated only once per hour and the value is always increasing (a meter where I can only retrive data once per hour due to power constraints).
So when analyzing the item, its a nice stair, with a jump every hour.
Im using bar-graphs to combine multiple items to see the difference per hour, and with items that are updated once a minute or even more often, there is a bar for midnight. But with the hourly data, the first bar is always missing for an intra-day chart.
Any idea if I did something wrong or if there is a workaround?
Make sure a value gets persisted before 00:00:00.000. Midnight is the start of the current day. 23:59:59.999 is the last millisecond of the current day.
If you are saving only once per hour on the hour, the value saved for midnight ends up being the first value for the new day and you do not end up with a value for the end of the current day. You’ve saved no data between 23:00 and 00:00 to chart.
So you need to add a value saved to persistince before the end of the day, maybe one second before midnight. You can set a strategy in your persistence config to save this one Item one second before midnight or you can create a rule that runs one second before midnight and calls .persist on that Item. Either will give you that last value of the day.
I have set my script to run on every 59th minute. Now it works. though I dont unterstand why. Because the last value for the old day was at 23:00:00, so shouldnt that be enough?
I wouldn’t think so if for no other reason that if you want the value for the end of the day, by the hour, you probably want to chart the value at the end of the hour, not the beginning of the hour.
But if the last value for the day is 23:00, which is the beginning of the 23rd hour, you won’t have a value for the end of the 23rd hour. If the bar chart takes that into account I would not expect it to render anything for the end of the hour.