Hi,
I want to display a left and a right y-axis for a series of wind speed measurements. The speed should be shown in m/s on the left y-axis and in km/h on the right y-axis.
I tried to solve it by having two measurements. However, both are shown in the legend and it is difficult to scale both y-axes so that you only see one graph. They have to overlap exactly. And when hovering, both graphs are shown.
Exactly. The measuring points contain a time stamp and a value (wind speed in m/s). I can easily display these (x-axis: time, y-axis: wind speed m/s).
On the right side I would like to have the second axis: wind speed in km/h.
Currently this is how I “solved” it:
// Abfrage für Windgeschwindigkeit in m/s
windSpeedMs = from(bucket: "mobile1")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "windspeed")
|> filter(fn: (r) => r["_field"] == "value")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> map(fn: (r) => ({ r with _field: "Windgeschwindigkeit (m/s)" })) // Feldname ändern
// Abfrage für Windgeschwindigkeit in km/h
windSpeedKmh = from(bucket: "mobile1")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "windspeed")
|> filter(fn: (r) => r["_field"] == "value")
|> map(fn: (r) => ({ r with _value: r._value * 3.6 })) // Wert multiplizieren für km/h
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> map(fn: (r) => ({ r with _field: "Windgeschwindigkeit (km/h)" })) // Feldname ändern
// Alle Abfragen zusammenführen
union(tables: [windSpeedKmh, windSpeedMs])
|> yield(name: "mean")