Problem:
The problem is that the values in the legend of the Graph do not adjust according to the selected time period. The min./max.avg. of all data is displayed.
How can I configure, so that the values adjust depending on the selected time period?
@jump2021 I’m fairly sure that the problem is that you have no time filter on your query. This means that the whole table is queried by Grafana regardless of the time range you’ve selected - meaning that Grafana is showing you the Min and Max over all time. You need to add Macro: $__timeFilter as part of the WHERE clause. Check out the examples in MySQL | Grafana Labs.
It has nothing to do with the Grafana version as long as you’re using a recent one; @habib1 is sending you on a wild goose chase.
Got it @jump2021 - I think this is what you need: on the line with the WHERE clause (where you currently have id=4 in your screenshot) click on the “+” button on the right to add a condition. The $__timeFilter condition should appear in the drop down - select that.
If you check out the screencast video just under MySQL | Grafana Labs you can see the time filter condition being applied in that user’s video. Hope that helps.
@habib1 you are right, I shouldn’t have judged the intent of your statement. Perhaps you have a genuine desire to help.
However, a large proportion of your posts appears to fall into one of the following categories:
Randomly asking people to upgrade/downgrade Grafana or other parts of their system, without any indication of why that might help resolve their issue (example in this thread, as well as one, two, three)
Insisting that people should answer questions or take actions that don’t appear to have any relevance to the topic (example one, two, three)
Authoritatively telling people that what they want to do is not possible even when that’s not true (example one, two, three)
Wanton criticism/borderline abuse directed at people who have genuine questions they’d like to discuss (example one, two)
I would like to give you the benefit of the doubt, and there are certainly situations where your participation is helpful. But based on the above observations, it’s hard for me to feel that your intention here is to be constructive. Therefore my comment.
i found a soulution/example in the iobroker forum.
when i change the SQL-Query in Grafana to:
SELECT
ts/1000 as time_sec,
val as value,
“Temp” as metric
FROM ts_number
WHERE __unixEpochFrom() * 1000 < ts and __unixEpochTo() * 1000 > ts and id = 4
ORDER BY ts ASC
Off topic: He seems to be just a “copy” of suspended user Profile - melrose - Grafana Labs Community Forums . Unfortunately, community admins are not taking any actions so far, although this behavior was reported. 🤷
I don’t feel I would like to contribute to this forum anymore.
Huh yeah @jangaraj, the resemblance is uncanny. @samcoren, might be worth taking a look?
And yeah, the whole situation is pretty disheartening. Though for me it’s hard to understand why something as niche as the Grafana community forum would be an attractive stomping ground for any half-capable troll. Surely the internet is full of more verdant pastures?..