# Conditional Color in Bars Graph

**URL:** https://discuss.elastic.co/t/conditional-color-in-bars-graph/381810
**Category:** Kibana
**Created:** [September 9, 2025, 4:25pm UTC](https://discuss.elastic.co/t/conditional-color-in-bars-graph/381810 "2025-09-09T16:25:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mauro\_Campos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauro_campos/32/144950_2.png) [@Mauro\_Campos](https://discuss.elastic.co/u/Mauro_Campos)
#### Post date: [September 9, 2025, 4:25pm UTC](https://discuss.elastic.co/t/conditional-color-in-bars-graph/381810/1 "2025-09-09T16:25:50Z")

</div>

Hello, good morning.

Its possible to change the bar color based in the record input?

Example:

If Records \> 100

Color = Red

Elif Records \<= 100

Color = Yellow

Elif Records \<= 50

Color = Green

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4ec78c88db7c33cff3018aae80f3cb5b97d9f3ca.png)

---

<div class="post-metadata">

### Author: ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)
#### Post date: [September 10, 2025, 3:49am UTC](https://discuss.elastic.co/t/conditional-color-in-bars-graph/381810/2 "2025-09-10T03:49:41Z")

</div>

Hello @Mauro_Campos

Welcome to the Community!!

In metric view we have this kind of color specific conditions which can be applied.

If you still need this in bar diagram then we will have to use layering , please find below details related to same :

> **[Kibana: How to create impactful visualisations with magic formulas ? (part 1)...](https://www.elastic.co/observability-labs/blog/kibana-impactful-visualizations-with-magic-formulas-part1)**
>
> We will see how magic math formulas in the Kibana Lens editor can help to highlight high values.

Example :

> **Sample formulas from above link.…you need to review as per your bar chart :**
>
> Red =\> average(bytes) \* clamp(floor(average(bytes) / 15000), 0, 1)  
> Green =\> average(bytes) \* clamp(floor(average(bytes) / 10000), 0, 1) - average(bytes) \* clamp(floor(average(bytes) / 15000), 0, 1)  
> Blue =\> average(bytes) \* clamp(floor(average(bytes) / 5000), 0, 1) - average(bytes) \* clamp(floor(average(bytes) / 10000), 0, 1)
> 
> ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/3/037bbbce1c5081c2cef55b8990751bb999848843.png)

Thanks!!
