-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Graph does not continue last value to current time #7778
Comments
Grafana does not invent values as would be required in this case, would be tricky as could be not what the user wants in many cases. In graphite there is a function keepLast that will make the database query keep last value, should have worked in your case. Think InfluxDB has fill(last) which works the same but not sure. |
The problem with fill(previous) is that it uses group by and requires an aggregate on the select. For a binary state, aggregation of the values via mean() results in improper display of the data at certain zoom levels. It does allow the previous value to continue to current time on the graph, but it means trading one incorrect visual representation for another. I don't expect Grafana to "invent values", but expect it to be smart enough to display the current state of a measurement even if the latest result is not within the currently selected time range. |
That is the responsibility of the TSDB query language. Graphite can do this for example. Much better to put this logic in the query. No way for Grafana to know that this is desired behaviour other than a a specific option for this. But it's a feature that feels much better placed in the query & transformation layer (TSDB query engine).
Would not max(value) or last(value) work for your case? I mean there are other aggregations functions than |
They are under Selectors (don't blame grafana for the strange categorisation, I took it from InfluxDB docs) |
For reference, see also #2296, as this issue seems to be a duplicate of that one. |
In case of staircase graphs, this can be easily worked around with manual SQL by returning an extra row with a fixed value in the distant future. This way the graph will continue the line to the right and beyond. The fixed value can be whatever, just use 0. The way to do this depends on the actual SQL engine, for example for MySQL/MariaDB you can use UNION like this: (SELECT <actual query>) UNION (SELECT 10000000000000000, 0) |
Please include this information:
4.0.1
InfluxDB
Raspbian Jessie
Created a chart containing data from a sensor that reports a binary state. I used stiarcase display option with line and fill to indicate the state of the data.
I expect that this combination of options (staircase + line) will automatically continue the line representing the last reported value to current time.
The graph does not represent the current state of the sensor since the line does not continue past the last recorded value to current time. This means that if the last recorded datapoint is outside of the current time window, then the visual representation of the data is incorrect.
SELECT "value" FROM "binary_sensor.test_door" WHERE time > 1488940908s and time < 1488941178s
{ "results": [ { "statement_id": 0, "series": [ { "name": "binary_sensor.test_door", "columns": [ "time", "value" ], "values": [ [ 1488941015270, 0 ], [ 1488941018852, 1 ], [ 1488941033473, 0 ], [ 1488941047516, 1 ] ] } ] } ] }
The text was updated successfully, but these errors were encountered: