Grafana with InfluxDB: keep colors of series when refreshing

  • What Grafana version and what operating system are you using?
    v10.1.1 (Docker on Debian 11)

  • What are you trying to achieve?
    Keep colors of series in a time series graph stable between refreshes

I have a flux query returning mutiple time series. Every refresh of the data (my dashboard auto refreshes every 10 s) changes the order of the flux tables and thus the order of the grafana time series and the auto coloring of the series leads to changed color per series.

I searched for a way to order these series in grafana (the tag values are not fixed but unknown). Did not find it.

Now I order in the flux query. That works. But I am unsure if there is a more efficient way to solve this issue, either in flux or in grafana.

This is my flux query:

from(bucket: “my_bucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “my_measurement”)
|> filter(fn: (r) => r[“_field”] == “my_field”)
|> group()
|> sort(columns: [“my_tag”])
|> group(columns: [“_time”, “_value”], mode: “except”)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)

Any hints to improve that? Especially the two “group()” steps only for fixing the order feel not very efficient.

Thanks in advance!

Welcome @keith8925

You wrote:

and I would say that as long as you are not experiencing any long delays with refreshing every 10s, then just leave it as is. I do not think the group statements are that intensive for computing power.