Grafana Bar Chart and Flux Query - Convert to String?

Hello Community,

I want to use the Bar Chart in Grafana and a flux query to display sum “Current” per day e.g.

The problem is ( I think), grafana seems to want da string value instead of datetime.

from(bucket: "sdm630")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "data")
  |> filter(fn: (r) => r["_field"] == "value")
  |> filter(fn: (r) => r["device"] == "SDM1.1")
  |> filter(fn: (r) => r["type"] == "CurrentL1")
  |> aggregateWindow(every: 10m, fn: mean, createEmpty: false)
  |> yield(name: "mean")

Error Msg in Grafana: Bar charts requires a string field

Has anyone an idea to display grafana bar chart with flux?


Hello @Guido_Berger,
Have you tried using the toString() function?