Unable to change legend name in Grafana using InfluxDB as Datasource and Flux as query language

Unable to change the legend name in Grafana using InfluxDB[flux as query language]. Previously I was using InfluxQL as query language and at that time, grafana provided an option to set the legend name. But after switching to flux, that option seems to be missing. Now it’s always showing the legend name as _value , I need to change it to some custom text. Please find below the query I’m using. Thanks for your time in advance.

bucket1 = from(bucket: "NOAA_water_database/autogen")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "ak_api_time" and (r._field == "device_id"))
  
bucket2 = from(bucket: "NOAA_water_database/autogen")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "ak_app_launch" and (r._field == "device_id"))
  
union(tables: [bucket1, bucket2])
 |> filter(fn: (r) => (r.browser == "chrome"))
 |> group(columns: ["device_id"])
  |> unique(column: "_value")
    |> count(column: "_value")

3 Likes