# Assign colors to boolean pie chart

**URL:** https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486
**Category:** Kibana
**Created:** [January 15, 2022, 5:40pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486 "2022-01-15T17:40:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![kequach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kequach/32/99814_2.png) [@kequach](https://discuss.elastic.co/u/kequach)
#### Post date: [January 15, 2022, 5:40pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/1 "2022-01-15T17:40:55Z")

</div>

I want to have fixed colors for true/false. At the moment, the color palette simply assigns the bigger value to the default color which makes it hard to tell in one glance if the piechart is mostly false or true:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/b/6bc45dba152321da4df850d9fc881381977cf213.png)  
I already found this thread here while searching for this issue: [Pie chart colors change](https://discuss.elastic.co/t/pie-chart-colors-change/184036)  
But I can't seem to use the canvas to solve this problem. Is it because of the datatype?

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [January 17, 2022, 9:20am UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/2 "2022-01-17T09:20:01Z")

</div>

Hi @kequach ,

welcome to the Kibana community.

If you're only concern is about color consistency for boolean values, I can suggest the filters workaround:

- Instead of `Top Value`/`Terms` use a `Filters` aggregation
- Reorder the filters in the same order for all pies

 ![Screenshot 2022-01-17 at 10.15.27](https://us1.discourse-cdn.com/elastic/original/3X/f/a/fa4a3304d01c7675a684a6817de3c033f52adfe4.png)

The configuration above was made in Lens editor: palette colors will be assigned in order of filters which can be useful for consistency.

---

<div class="post-metadata">

### Author: ![kequach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kequach/32/99814_2.png) [@kequach](https://discuss.elastic.co/u/kequach)
#### Post date: [January 17, 2022, 1:54pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/3 "2022-01-17T13:54:07Z")

</div>

Hi @Marco_Liberati ,

thanks for the response. I tested the filter solution but the visualizations don't change:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e44b35cd2ec190704d1e3a2be659270743163386.png)  
In the following screenshot I changed the order of the filters:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/e/9eab443d263c72c944df187869d2ddf9e073a795.png)

This is also visible in your screenshot. I would expect true to be the green color, as it is first in order. However, for your example, it is also the larger group (false) that is green. It functions the same way the "Top values" works.

---

<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 17, 2022, 2:32pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/4 "2022-01-17T14:32:49Z")

</div>

Hey @kequach, this is a feature that we are planning to add in Lens soonish 🙂  
For now, you could also use the aggregation-based visualizations.

If you click on the legend item there is a color picker with a set of colors that you could use for true/false.

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

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [January 17, 2022, 2:42pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/5 "2022-01-17T14:42:10Z")

</div>

Oh right, sorry. Partition charts like Pie or Treemap enforce a sorting of the slices no matter the filters. Other types of charts will respect the filters order.

---

<div class="post-metadata">

### Author: ![kequach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kequach/32/99814_2.png) [@kequach](https://discuss.elastic.co/u/kequach)
#### Post date: [January 17, 2022, 2:53pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/6 "2022-01-17T14:53:22Z")

</div>

Thanks! It's a bit annoying to do it for every piechart (there are around 10 of them in total) but at least this works now.

---

<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 17, 2022, 2:54pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/7 "2022-01-17T14:54:44Z")

</div>

Yes we know 🙂 But we are working on making it work more effectively in Lens!

---

<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 14, 2022, 2:55pm UTC](https://discuss.elastic.co/t/assign-colors-to-boolean-pie-chart/294486/8 "2022-02-14T14:55:15Z")

</div>

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