Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add colours in Table Panel of grafana

Tags:

grafana

I have created a table panel in Grafana as below:

Table panel in Grafana

My requirement is to make the status column to have corresponding color shown instead of having the value "Yellow", "Green"... i.e. the word "Orange" should represent the color as below:

Colour to be shown instead of "Orange"

like image 916
Shwe Avatar asked Oct 29 '22 11:10

Shwe


1 Answers

I just found the solution/workaround to this, since I was also looking for a solution. The solution is pretty similar to the first answer, but doesn't rely on an extra column (1,2,3).

Limitation: this only works for 3 rows, since we are going to use the threshold function which allows only 3 color values. (maybe by adding another rule you could use more colors..?)

Here goes:

  1. In the "Queries" section of your table instead of text/strings give each row a numeric Alias eg. 1, 100 or 500 (choose values that are a bit apart, since these are the values the threshold is going to differentiate from).

  2. Then switch to the "Visualisation" panel of the same table and create/change the rule for the column "Status" to "Type: Type=String" and in "Value mappings"--> "Type: Value to text".

  3. Under "Value to text" you 'give back the text' to the values you defined earlier, e.g 1 = Yellow, 100 = Red, 500 = Green [..]

  4. Now you can add the color to each row containing aString, by using the Threshold function: "Thresholds=100,110" (if you chose 1, 100 and 1000 before) "Color mode=row" "Colors:" (from lowest to highest) | Yellow | Red | Green.

And that should do it.

like image 69
Dominic Avatar answered Nov 15 '22 09:11

Dominic