How to show field name in Legend?

Hi there,

I’m using InfluxDB for a Sensor named “Office 1” that measures Temp, Hum, CO2.

When using Grafana the measurements are stored in database “events”.
I then select from Office 1 and have all 3 fields as fields available in Grafana.

However, the Legend shows “Office 1” for each line in the Graph, which is not very helpful.
I’d like to show the field name instead (Temp/Hum/CO2) but there doesn’t seem to be a $field placeholder
for the Alias By field.

How can I do this?
And: Am I doing this wrong? Should I save my measurements differently? I think this is the default
Influx way to store data so I’m confused…

try using $col in the alias by field

Thanks for the answer, unfortunately
$col does not work, it just displays “mean” - is there any other way?

Does anyone have an idea?

This is most likely because you did not add an “alias” to the field. Adding the alias, will make that value available as $col

1 Like

In influxDB, use $tag_[tag_name] , ex: $tag_path

https://community.grafana.com/t/influxdb-alias-by-other-column-value/12222/3