Changing text color in table panel

Can we change the color of a cell based on an other cell?
Suppose we have two columns: performance and performance_threshold

performance_threshold value can be 0/1
based on this value, the color of performance cell should change.

OR
Is there a way to set threshold per row?

5 Likes

+1
I was just looking for how to do this :confused:

Color row used to be an option, but I do not believe it still is.

Use Overrides to select a column you like to add effects to.

4 Likes

@gurpartapsbhatti, I wanted something which can apply threshold row wise. Or where one column’s threshold depend on an other column

I’m not sure if I understand what you mean. The way I understood is that since ‘value’ of Total column depends on metric1 and metric2, therefore the threshold for Total depends on the ‘value’ of metric1 and metric2.

Is this possible where the value is textual? eg: elasticsearch status colours? (green, red, yellow)

1 Like

Its possible to color cells with Textual values

1 Like

I don’t understand how to choose the colour in the value mapping editor?

Good question!
I’m looking for the same.

3 Likes

Example I gave you was from Grafana 8.0 beta, I don’t think its available in the older versions.
https://play.grafana.org/d/U_bZIMRMk/table-panel-showcase?orgId=1

1 Like

I’ve found a feature request on this

Useful discussion, thanks, to all!

you can use emoji to replace text value.

I found the following way to color table cells based on text value, by taking advantage of the fact that threshold colors get evaluated before value mappings are performed.

So, say you have some query that returns label values A, B and C, and you want to color them in a table with red, green, blue respectively, here’s what you do:

1. Modify your query to map the label values into numbers.
For example, change the query (where the possible values of namespace are A, B and C):

sum(cpu_usage{cluster="my_cluster"}) by (namespace)

to:

sum(
 label_replace(
 	label_replace(
 		label_replace(
 			cpu_usage{cluster="my_cluster"},
 			"namespace", "1", "namespace", "A"
 		),
 		"namespace", "2", "namespace", "B"
 	),
 	"namespace", "3", "namespace", "C"
 )
) by (namespace)

2. Define threshold colors so that:
1 => red
2 => green
3 => blue

3. Define value mappings so that:
1 => A
2 => B
3 => C

Hey guys, i have been checking version 7 and 8 and still dont see how to make it work, i have a name of something call it “City” and i want to color it based on the value of temp, and thats it, i dont want to show the temp, i just want to show the city name colored by something else.

before i did it whit the row background color, but now is not doable.

can you help me, or do i miss something?

3 Likes

+1

I want to do something very similar like @pakoche1 .
Is this possible in some way?

Same, I am also looking for the functionality that @pakoche1 mentioned.

Specifically, I have a field for date and I want to know how overdue that date is. For example, if the date was 7 days ago it’s red, 3 days ago it’s yellow, etc. You can easily format the date to show “7 days ago” versus “2022-02-16”, for example, but there is no way to color that cell based on the duration.

I can partially produce what I want by doing something like UNIX_TIMESTAMP()-UNIX_TIMESTAMP(some_date), then coloring the cell based on how many seconds have passed, but this is ugly and unintuitive for the end user. (How long ago is 599282 seconds?)

1 Like

Is any one has the solution for this?

Can we change the color of a cell based on an other cell

I am using two panel.

1st panel having the column a,b,c
2nd panel having the column a,d,e

using transform i join both the panel…

I can see the data in table a,b,c,d,e

I want to compare b,d is not equal change the colour of b and d.
like wise if c and e is not equal change the colour of c and e.

is this possible.

2 Likes

I am trying to change the color in dashboard Diskspace row should be orange and monitor Down should be red. I am using Grafana v6.0.0. Does anyone know how to do this. Thank you in advance.

Welcome to forum @rkoirala82

1 Like