Hide some legends and filter data by clicking on the displayed legends

What you expected to happen:

I have a panel like this:

My MYSQL query returns the moisture, CC, PMP and UC given a sensor. So each moisture time series has a CC, PMP and UC time series.

I want to be able to filter by clicking on the name of the legend the moisture, CC, PMP and UC data of that sensor. And I want only the legends for moisture to appear. The legend CC, PMP and UC want to hide.

I want something like this:

Example image only.

Is it possible to do that? Please help.

Anything else we need to know?:

The SQL query I do on the panel:

calculated_measures.timestamp AS “time”,
calculated_measures.moisture AS “moisture”,
sensor_devices.board_id AS “sensor”,
plots.name AS “talhão”,
soil_parameters.fc AS “CC”,
soil_parameters.pwp AS “PMP”,
soil_parameters.moisture_critical AS “UC”
FROM calculated_measures
RIGHT JOIN sensors ON calculated_measures.sensor_id = sensors.id
LEFT JOIN soil_parameters ON sensors.id = soil_parameters.sensor_id AND (${parametros_solo:doublequote}) = “SIM”
LEFT JOIN sensor_devices ON sensors.id = sensor_devices.sensor_id
LEFT JOIN plots ON sensors.plot_id = plots.id
RIGHT JOIN farms ON plots.farm_id = farms.id
farms.name in(${Fazenda:doublequote}) AND
sensors.deleted_at IS NULL AND
calculated_measures.timestamp IS NOT NULL
GROUP BY time, sensor, CC, PMP, UC


  • Grafana version: Grafana v9.3.6 (978237e)
  • Data source type: MySQL Data Source - Native Plugin
  • User OS & Browser: Windows & Chrome