- What Grafana version and what operating system are you using?
Docker config on windows 11 + Grafana v11.2.0 (2a88694fd3)
- What are you trying to achieve?
I have a graph with values 0 or 1. I show 0 and 1 as green bars but if the Description for the tool contains the text (“MT1“) i want to color the green bar for example red.
I’m using a mixed data source and I join on Code
Influx:
import "regexp"
import "strings"
import "array"
from(bucket: "DEMALU_Francovera")
|> range(start: 1970-01-01T00:00:00Z)
|> filter(fn: (r) =>
r.\_measurement =\~ /^S123547\\/BITS\\/E\\/E311/
)
|> filter(fn: (r) => r.\_field == "value")
|> sort(columns: \["\_measurement"\])
|> last()
|> map(fn: (r) => ({
// Use regex to extract the part you want from \_measurement
Code: regexp.replaceAllString(
r: /.+\\/BITS\\/E\\/(.+)/,
v: r.\_measurement,
t: "$1"
),
value: r.\_value
}))
|> map(fn: (r) => ({
r with
Code: strings.replaceAll(v: r.Code, t: "/", u: ".")
}))
MySQL
select ni.Code,ni.Type,ni.Description,ti.Description as info from tb_nodeinfo ni left join tb_toolinfo ti on ni.Name= ti.Name
