Plotting array data from InfluxDB with Plotly plugin

  • What Grafana version and what operating system are you using?
    Grafana v10.2.2 on Linux

  • What are you trying to achieve?
    I have an array of data (a current trace) that I’m injecting into an InfluxDB instance as a string and then applying some data manipulation to in order to recover the array. I’d like to take this array of data and plot it using the Plotly visualization plugin and have this update every so often when new data comes in.

  • How are you trying to achieve it?
    I’m currently reading in the data from InfluxDB as

import "array"
import "strings"
from(bucket: "MyBucket")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "MyMeasurement" and r.sensor == "trace")
  |> map(fn: (r) => ({r with _value: strings.split(t: " ", v: strings.substring(start: 1, end: 3072, v: r._value))}))
  |> last()
  |> yield()

but not sure what this data output looks like and how to now use it for plotting in Grafana

  • What happened?
    I get an error with this query saying invalid: runtime error @7:6-7:118: map: map object property "_value" is array type which is not supported in a flux table

  • What did you expect to happen?
    I’d like the data to be in a format I can use with Plotly.

  • Did you follow any online instructions? If so, what is the URL?
    I’ve followed along with here, here and others but I’m not too familiar with how to massage the query output for use with Plotly.