Struggling setting up the Grafana Diagram plugin with Flux query

Hi community,

I’m struggling on how to map my InfluxDB 2 data with the Grafana Diagram plugin.

For testing purpose I’m using the next flux array to generate a table:

import "experimental/array"

array.from(rows: [
    {name: "solar", last: 2.0},
    {name: "home", last: 13.0}
])

My mermaid diagram definition:

graph LR
     solar((fa:fa-sun-o <br/>3))  --> home

I do not really understand how to show/map my query results (2.0 and 13.0) in the Diagram.

In the documentation I can read that the target/alias of the series is compared to the ID of the diagram. It should be the case… my table returns:
name | last
solar | 2
home | 13

I have also tried with a table returning:
solar
2

Same issue :frowning:

Thanks you very much for the help.

Chris

After doing some research on the internet and after playing with a real flux query I succeed to make it work. My query contains a pivot that creates columns and every column name matches a mermaid node. Also discovered that even if not used I needed a _time column !

Flux result:
_time | Solar | Grid
2021-01-01T00:00:00Z | 2 | 5

Mermaid

graph LR
     Solar --> Grid

Works and shows a diagram with 2 → 5

Thanks

1 Like