# Kibana bar chart legend set constant color

**URL:** <https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288>\
**Category:** Kibana\
**Created:** [January 2, 2023, 8:19am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288 "2023-01-02T08:19:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [January 2, 2023, 8:19am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/1 "2023-01-02T08:19:30Z")

</div>

Hello,

I've a simple requirement where in I need to set constant color for bar and legends.  
ex:  
Error:Always red, Success:Always greeen,Initialize:Always yellow...etc  
The current behaviour of kibana dosen't fullfill thisrequirement,Whenever I select timeranges say  
24 hours,15 min,month week etc...the color cahnges automatically.I'd require this to be non changing and always constant.  
I'm not sure whether this is bug or any possibilities to achieve this in kibana? , any time range selected the color should not change as here Red indicates Alert,Green success etc.  
ELK version used:7.9.1

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

Many Thanx

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [January 3, 2023, 2:10pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/2 "2023-01-03T14:10:58Z")

</div>

Hi @PRASHANT_MEHTA.

We have an [open feature request for this in Lens](https://github.com/elastic/kibana/issues/101942), but it hasn't been implemented yet.

I think the best way to customize colors on a visualization is using TSVB. Here's an example where I set specific colors for HTTP responses.

 ![tsvb-colors](https://us1.discourse-cdn.com/elastic/original/3X/a/b/ab89632dc8c14dfef12feb01726d8ee513e0c627.jpeg)

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [January 4, 2023, 7:53am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/3 "2023-01-04T07:53:47Z")

</div>

Hi @nickpeihl ,

Thanx for your time to look into this,My intention is to use Vertical bar and maintain constant color.  
I'm not sure how can I set non changing color.Is there a possibility or way for vertical or horizontal bar visuals?  
Kibana 7.9.1

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2f659d8faa19def30015db0853514e348ec6e79c.png)

Thanx

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [January 4, 2023, 3:59pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/4 "2023-01-04T15:59:00Z")

</div>

Hi @PRASHANT_MEHTA.

I do not believe it is possible to keep constant colors in the legacy visualizations.

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [January 18, 2023, 12:32pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/5 "2023-01-18T12:32:57Z")

</div>

Hello All,

The work around may be used for above issue,gets applied global level,not supported for individual visual or dashboard to persist color.

Advanced settings in kibana:

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

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [January 18, 2023, 12:55pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/6 "2023-01-18T12:55:23Z")

</div>

Hey @PRASHANT_MEHTA. There are 2 ways to accomplish what you want:

- The one is what you mention above and is global
- The second one is clicking on the legend and select a color (from the given ones)

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

My screenshot is from a more recent kibana version but it is also available on 7.9

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [January 19, 2023, 8:09am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/7 "2023-01-19T08:09:32Z")

</div>

Hi @Stratoula_Kalafateli ,

Thanx fot your time to look into this.For now global level works fine.The clicking on legend and setting color dosen't seems to work fine.  
While setting the colors from legend for any given visualization the color dosen't persist.I'm not sure why this happens or may be bug.  
Using kibana 7.9.1 and here on vertical,Horizontal or pie the color when set from legend dosen't persist.Everytime dashbaord is reloaded or seen,then the color changes.  
Global level was saviour for now as usecases require particular color to be set for specifying meaning in bar. ex:red-error,success-green.  
Are you aware where is this option on visual : **uiStateJason**? , I tried searching but now aware exaclty where it could be found.

Many Thanx

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [January 19, 2023, 8:34am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/8 "2023-01-19T08:34:13Z")

</div>

Yes I remember we had a bug back then so possibly you are hitting this. This is saved on the saved object on the uiStateJson property. You can't see it on the editor. Except from the legend of course that depicts the overwrites

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/9/6952f0810d4dd4062864538e1e78aed03968fda7.jpeg)

We are working in Lens to give this capability and it will work with more efficient way.

---

<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:** [February 16, 2023, 8:34am UTC](https://discuss.elastic.co/t/kibana-bar-chart-legend-set-constant-color/322288/9 "2023-02-16T08:34:14Z")

</div>

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