Data history in a custom widget

Data history in a custom widget

Hello,
 
I want to create a custom widget to display a chart with accumulated historical energy data. Therefore, my question is how to send not only the most recent data value to my custom widget but also the values from today, last week, or last month. I already had a look at these sites, but I did not find a suitable solution there.
 
 
I attached a picture of my current custom widget. The idea is that when you click one of the buttons, the chart shows the summarized data, e.g., for a day with 6 bars, where each bar represents a time interval of 4 hours. I hope you understand what my idea is, and I'm looking forward to your suggestions.
 
Thanks in advance.
 
Tammo Post
        Take a look at our updated roadmap here!
          What would you like to see on TagoIO?