Seeking advice on populating a chart

Let’s say I have a database with two values:

  • A time stamp
  • A value from 0-100

new data is put into the database only when the value changes so there’s no constant interval between the records.

If I wanted to make a chart for let’s say the past week, I can’t just loop through them and get the result I’m looking for (let’s say monday, tuesday, etc).

What is the best practice to achieve this? Average them and display?