Color by field name

Hello,

I have the following query result and I would like to use the same color for every sensor in every blocks:

When I group the data only by ‘name’ I can achieve this, but all the blocks are merged.
I am using flux for query language.

Can you give me an idea how to move on?
Thank you!

What kind of visualization is that?

The built in TimeSeries.
Grafana version: 9.3.2

1 Like

Can you please share your Flux query?

Sure:

from(bucket: "v6")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "cp_channel")
  |> filter(fn: (r) => r["_field"] == "pMax")
  |> group(columns: ["block", "name"])
  |> yield(name: "mean")

Could you share what table(s) are produced by this query using Influx Data Explorer? Just wanting to get a better idea of the columns being returned by your query.

Here it is: https://file.io/WvD57jxYubr2

Not seeing anything in that link…

I hope this one works: Easyupload.io - Upload files for free and transfer big files easily.

Got it. Thanks. I am not able to throw this into my InfluxDB at the moment, but I did think of this…can you just change the color of each item on the legend to the same color? Just click on the colored bar in the legend and pick a color? Or is that not the issue? I suppose you could use Overrides in Grafana as well.
image

Yes, that was my first idea. But the number of the sensors are not fixed. I suppose there is a fixed number of colors in grafana, so that the first sensor always have the color A, the second one is B, etc. This is fine because each sensor position will have the same color. But when I use the extra tag ‘block’, this order can not be maintaned.

@grant2, Do you have any idea to move on?

Hi @danielvamos

Sorry for the delay. Does creating an Override like this help apply the color to each “block”? I guess this assumes all the values are being returned by the same Query A.

1 Like