# Order legend items

**URL:** <https://discuss.elastic.co/t/order-legend-items/314168>\
**Category:** Kibana\
**Created:** [September 12, 2022, 7:46am UTC](https://discuss.elastic.co/t/order-legend-items/314168 "2022-09-12T07:46:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabrizio1979](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabrizio1979/32/110738_2.png) [@fabrizio1979](https://discuss.elastic.co/u/fabrizio1979)\
**Post date:** [September 12, 2022, 7:46am UTC](https://discuss.elastic.co/t/order-legend-items/314168/1 "2022-09-12T07:46:17Z")

</div>

Hi there,

How to order the legend items displayed on graphs? I used graphs.  
 ![k_1](https://us1.discourse-cdn.com/elastic/original/3X/8/1/813c46903b2054b48ca282baec9bea1956f855b7.png)  
I would like legend items ordered as A1 A2 B1 B2  
Thanks

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [September 26, 2022, 12:52pm UTC](https://discuss.elastic.co/t/order-legend-items/314168/2 "2022-09-26T12:52:27Z")

</div>

Hello, what do you mean you used graphs?  
Unfortunately you cannot order the items for terms aggregation, but if you know the values of the field, you could instead use filters aggregation (it's slower than terms performance-wise) and then you can control the order:

 ![Screenshot 2022-09-26 at 14.52.04](https://us1.discourse-cdn.com/elastic/original/3X/e/4/e477d2ddee29bf3312d561b3e3daa45fca2b635b.png)  
 ![Screenshot 2022-09-26 at 14.51.54](https://us1.discourse-cdn.com/elastic/original/3X/8/5/854ea7587149a1a6d2eabade0ee2a9b1ff2ea30a.jpeg)

---

<div class="post-metadata">

**Author:** ![fabrizio1979](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabrizio1979/32/110738_2.png) [@fabrizio1979](https://discuss.elastic.co/u/fabrizio1979)\
**Post date:** [October 6, 2022, 5:57am UTC](https://discuss.elastic.co/t/order-legend-items/314168/3 "2022-10-06T05:57:51Z")

</div>

Hello Marta,

Thanks for your answer.  
I can't found the way you did your example.  
I have choosen 'Aggregation based', then 'Vertical bar'. As a X bucket, I select 'Date histogram'. Then 'Split series', I create my 4 filters. if filters are created in reverse order (B2, B1, A2, A1), display looks correct. I will continue testing.

---

<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:** [November 3, 2022, 5:57am UTC](https://discuss.elastic.co/t/order-legend-items/314168/4 "2022-11-03T05:57:56Z")

</div>

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