# Color code table row and graph bar depending depending on a threshold

**URL:** <https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233>\
**Category:** Kibana\
**Created:** [November 5, 2022, 11:12am UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233 "2022-11-05T11:12:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murali\_Y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murali_y/32/98137_2.png) [@Murali\_Y](https://discuss.elastic.co/u/Murali_Y)\
**Post date:** [November 5, 2022, 11:12am UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/1 "2022-11-05T11:12:59Z")

</div>

Referring below/attached table screenshot:  
We want to show different color coding of a bar graph (or) a row item in a table depending on a threshold value.

Threshold is not same for processes mentioned under 'processes name' column.

From screenshot, we want to achieve:  
For BOT 1, when Execution% \> 75% then we want to show that row in Green.  
But for BOT 2, when execution% \< 50 %, then we want to show that row in Red.

Please suggest.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/60fcac8421cdfbf0c5510f6fb74d2d87eed55f97.png)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 5, 2022, 7:31pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/2 "2022-11-05T19:31:02Z")

</div>

What Version are you on?

---

<div class="post-metadata">

**Author:** ![Murali\_Y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murali_y/32/98137_2.png) [@Murali\_Y](https://discuss.elastic.co/u/Murali_Y)\
**Post date:** [November 6, 2022, 12:57pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/3 "2022-11-06T12:57:03Z")

</div>

@stephenb  
Thanks for responding. Version we are on: 7.16.  
Please suggest.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 6, 2022, 3:48pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/4 "2022-11-06T15:48:45Z")

</div>

Use Lens Table. I think this should work for 7.16 (I am at 8.4 but pretty sure that was there)

The for the Column / Metric you want to color example Execution %

Set the metrics name and function like Average Execution %

If it is a Percent then set Data Then Color by Cell / or Text. This example show Cell

 ![Screen Shot 2022-11-06 at 7.44.43 AM](https://us1.discourse-cdn.com/elastic/original/3X/6/a/6a5ebf6e0569cff2290fa280a5316187a0b26fdd.png)

Then Edit The Color Setting

Now here is the tricky part _DO NOT_ pick pick percent type IF your number is already a Percent  
Percent means pick a Percent of the Total Range which is a Percent of a Percent it will be confusing  
Pick Number

The UI is a little Weird / Strange / Buggy Pick your Colors and Start from your Max Color Down... it will sometime reset on you. But it Works

And that should work!

 ![Screen Shot 2022-11-06 at 7.43.36 AM](https://us1.discourse-cdn.com/elastic/original/3X/d/a/da23302f71a8a0620cffc537f57570a1c3361cc5.jpeg)

---

<div class="post-metadata">

**Author:** ![Murali\_Y](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murali_y/32/98137_2.png) [@Murali\_Y](https://discuss.elastic.co/u/Murali_Y)\
**Post date:** [November 6, 2022, 5:17pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/5 "2022-11-06T17:17:10Z")

</div>

@stephenb Thanks a lot 🙂 . With suggested approach I could color the table. But the issue in my case is that threshold is NOT same for all processes ('process name' column in screenshot).  
For process 1 threshold will be 50%, for process 2 it will be 75% etc. With current approach we can highlight rows with same threshold across all process names.

How can we put this additional condition- proces name and threshold combo? Please suggest.  
Thanks.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 6, 2022, 5:25pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/6 "2022-11-06T17:25:59Z")

</div>

Not sure I completely understand....

But in your layout no you can not do that as far as I know. You Can not create a different Color Scheme based on some the value of some other column

How many Process Types?

You could make the Separate Column / Metrics Filtered by the Process then you could define a color scheme for each

The only other thing I could think is make some Runtime field based on all the logic and use that.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 3, 2022, 1:28pm UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/7 "2022-12-03T13:28:38Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 31, 2022, 10:14am UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/8 "2022-12-31T10:14:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 28, 2023, 10:15am UTC](https://discuss.elastic.co/t/color-code-table-row-and-graph-bar-depending-depending-on-a-threshold/318233/9 "2023-01-28T10:15:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
