Graph only showing last value from MySQL, not all values since the page loaded

Hi,

I’m trying to get a simple graph working. The issue is that it only plots the most recent data point, rather than just adding it to the data it should have in memory. I fully expect it to clear the graph if the page refreshes, but while it’s open, it should accumulate the data over time and plot the data over time. At the moment, it refreshes every 10s and just plots at the current time every time.

Do I really have to have data for every 10-second interval that I want to display? That’s 360 entries in just one hour.

Show us the query you are using.
How often is data added to the database?
What time range are you showing in the graph?

I’m showing the last hour, and the data is updated every 10s. I just have a single record of the name and value. This value is what’s updated. I expect that the new value is appended, rather than replacing the existing plots.

SELECT UNIX_TIMESTAMP() as time,
( SELECT value FROM table WHERE series = ‘xxx’ ),

You should select the time from the table, you are just selecting the current time, and there is only one sample for that time. This is one of my queries

SELECT
  $__timeGroupAlias(measured_at,$__interval),
  avg(t_greenhouse) AS "t_greenhouse"
FROM samples
WHERE
  $__timeFilter(measured_at)
GROUP BY 1
ORDER BY $__timeGroup(measured_at,$__interval)

The time column in my database is measured_at