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…
If you were accessing the raw field ( without mean, last, etc ) and no groupBy - $col would contain the field name.
Without “Alias” (within grafana ux) or “AS” (in raw query editor) - Influx will return the function name that created the column, not the original field name; in the returned data.
As mentioned; you may need to manually set an ‘alias’ for each field you need in the legend.
Thanks a lot! For others, if you have something like:
SELECT func_name as metric, “count” as value FROM “unittest”.“autogen”.“DataGroup” WHERE $timeFilter GROUP BY func_name