A single measurement with two y-axes

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.

I hope there is a better solution.
Thanks

Welcome @leo.ntodon

Can you provide a CSV of some of your data? Also, since km/hr can be calculated from m/s, does your data just have 2 values (time and windspeed)?

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")

I hope this helps.

So you just want to see the same measurement in two units, right?

One possible way is to use one m/s metric returned by your Flux query and then use Grafana’s transformation for km/h calculation: