I have a “stat” panel showing a cumulated amount of power generated from my solar panels that shows the day-by-day build-up of that amount in the “stat panel graph / sparkline”.
What I did for the data was write a custom query that retrieves the full months data (including some forecast)
When I was running Grafana 7.1 that worked nicely, but after upgrading to 8.3.3 my data is now filtered “again” to only the time range of the dashboard instead of just using my query data as-is.
Is this a bug or a new feature?
I found sort of a workaround by putting the relative time to +6d (to include the forecast) and the time shift to 0M/M to show the whole month, but the result is that in the beginning of the month (like now), the graph line only fills half of the panel instead of using the whole width like it was before.
In the end, I would really like to have the ability back to put in a “hard” custom query and have the data graphed out without filtering, just like I could do in v7.1
AFAIK, the current version of the Stat Panel sparkline graph cannot be fed via a separate query. It will always be displayed based on the time dropdown selector.
Note I don’t want to feed it using a “separate” query, I just want it to display all records I put into it without “additionally” applying the time filter outside of the query.
This is my query for the stat panel:
SELECT
"startsOn" AS "time",
SUM("mostRecent" * 6000 / 4 / "monitoredCapacity") OVER (ORDER BY "startsOn") as "Month"
FROM solarforecast
WHERE "startsOn" >= date_trunc('month', TO_TIMESTAMP(${__from}/1000) AT TIME ZONE 'CET')
AND "startsOn" < date_trunc('month', TO_TIMESTAMP(${__from}/1000) AT TIME ZONE 'CET') + interval '1 month'
ORDER BY "startsOn"
So you can see I’m not using the query builder but wrote my own.
It retrieves data starting from “beginning of the month” to “end of the month” but still it seems Grafana 8.3 is applying the time range on top of the returned data instead of embedding it into the query as it did before.