How to Highlight the Cell with Maximum Value Dynamically

Steps to create highlight in cell

Step 1: Create table in database in my case (PostgreSQL) and insert data in it.

Step 2: Create new dashboard in Grafana and then select your data source to fetch the data.
• Click on Add Visualization

• Select the datasource

Step 3: Select table visualizations to show the data on panel using this query.

SELECT
“device_name”,
“00_hours”,
“04_hours”,
“08_hours”,
CASE
WHEN “00_hours” = MAX(“00_hours”) OVER () THEN ‘Green’
ELSE ‘White’
END AS col1_status_00_hours,
CASE
WHEN “04_hours” = MAX(“04_hours”) OVER () THEN ‘Green’
ELSE ‘White’
END AS col1_status_04_hours,
CASE
WHEN “08_hours” = MAX(“08_hours”) OVER () THEN ‘Green’
ELSE ‘White’
END AS col1_status_08_hours
FROM air_delivery;
Step 4 : Now apply transformation and follow the step mention below to Highlight the Cell with Maximum Value Dynamically in a Grafana Table Panel.
• Add Config from query results
• Configure the settings and apply this setting for all colums to highlight the cell with maximum value dynamically in table panel.

Now follow these step and repeat for all colums for every column new transformation add and configure the same setting (ie.”00_hours”)
• Now config query Choose : A
• Apply to : Fields with name
• Apply to options : your column name in my case(“00_hours”) and Select the field value mention in picture.
00_hours : Value mappings/Value | All values
col1_status_00_hours: Value mappings/Color | All Values

Step 5: Now go to panel settings , scroll down go to Cell options → Cell type → Colored background

Final Output.

1 Like