# Kibana Barchart visualization term sorting

**URL:** <https://discuss.elastic.co/t/kibana-barchart-visualization-term-sorting/127418>\
**Category:** Kibana\
**Created:** [April 10, 2018, 6:15am UTC](https://discuss.elastic.co/t/kibana-barchart-visualization-term-sorting/127418 "2018-04-10T06:15:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Athul\_Jayson](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Athul\_Jayson](https://discuss.elastic.co/u/Athul_Jayson)\
**Post date:** [April 10, 2018, 6:15am UTC](https://discuss.elastic.co/t/kibana-barchart-visualization-term-sorting/127418/1 "2018-04-10T06:15:34Z")

</div>

Hi,  
I have been working on creating a bar chart visualization in Kibana. I was able to plot the chart correctly, but I am having a slight problem with the labels. I want it to be in sorted order, but the sort function is not working as intended. The labels are string values.

Is there something I am missing here?

PFA, the visualization creation screen.

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/c/5/c5087e44aa20dcfba3a8fdbd8d087b3322bea835.png)

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [April 10, 2018, 6:21pm UTC](https://discuss.elastic.co/t/kibana-barchart-visualization-term-sorting/127418/2 "2018-04-10T18:21:53Z")

</div>

Hi there, can you try changing the order of your aggregations? In your case the visualization is doing the date aggregation and then splitting the terms within each date, which results in a sort within each bucket. The legend displays a very naive concatenation of these sorted results, which is why it appears as it does in your screenshot.

Hope this helps,  
CJ

---

<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:** [May 8, 2018, 6:22pm UTC](https://discuss.elastic.co/t/kibana-barchart-visualization-term-sorting/127418/3 "2018-05-08T18:22:03Z")

</div>

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