Hourly mean of an entity

I (HA beginner) would like to calculate the hourly average of an entity and display it in a diagram (Apex Chart Custom integration). I have tried it with the platform “statistics” and also with the “average sensor” (from HACS). I have been able to get both to work successfully. But I only want to have one value per hour (on the hour). However, the average value is calculated continuously and in the diagram there is a value every 5 minutes. Can I adjust this somehow? And where? My research so far has been unsuccessful.
Many thanks

Use your continuous average sensor but in apex charts use the group by and max value options. e.g.

series:
  - group_by:
      func: max
      duration: 1h

Great. Many thanks