# Canvas Bar charts : bars not always displaued in the same order

**URL:** <https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [February 20, 2019, 4:01pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253 "2019-02-20T16:01:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ranakel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ranakel/32/41004_2.png) [@Ranakel](https://discuss.elastic.co/u/Ranakel)\
**Post date:** [February 20, 2019, 4:01pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/1 "2019-02-20T16:01:22Z")

</div>

Hi,  
I have a bar chart in a workpad canvas in which I also have a control menu to apply a filter on my workpad.  
When I use this control , my values are correctly uptdated in the bar chart but the order of the bars sometimes changes whereas I would like them to be always the same (ascending alphabetical). Is there a way to force the order of the bars ?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [February 20, 2019, 6:31pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/2 "2019-02-20T18:31:40Z")

</div>

You sure can. If you open the expression editor, try adding `| sort by="x"` after `pointseries` and before `plot`. Could you let me know if that works?

---

<div class="post-metadata">

**Author:** ![Ranakel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ranakel/32/41004_2.png) [@Ranakel](https://discuss.elastic.co/u/Ranakel)\
**Post date:** [February 21, 2019, 9:07am UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/3 "2019-02-21T09:07:00Z")

</div>

Hi  
It doesn't work. I have this error message : Expression failed with the message:  
[plot] \> Can not cast 'datatable' to any of 'pointseries'  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![Ranakel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ranakel/32/41004_2.png) [@Ranakel](https://discuss.elastic.co/u/Ranakel)\
**Post date:** [February 21, 2019, 11:27am UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/4 "2019-02-21T11:27:47Z")

</div>

Il also have this error :  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/a/2a2fb8941a8f208693e52ed17ce2b86ae66b19c6.png)  
here is my code

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

Trying to type the name of the field was not helpfull too.

---

<div class="post-metadata">

**Author:** ![Ranakel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ranakel/32/41004_2.png) [@Ranakel](https://discuss.elastic.co/u/Ranakel)\
**Post date:** [February 21, 2019, 3:14pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/5 "2019-02-21T15:14:30Z")

</div>

I found a solution by changing my request to an esdocs rathen than esqlt and putting the sort after the query. It works fine 🙂 .  
Annabelle

filters  
| esdocs index="bds" query="\* where country='Ivory Coast'" sort="plateforme.keyword, asc"  
| pointseries y="community" x="plateforme" color="plateforme" text=""

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [February 21, 2019, 10:27pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/6 "2019-02-21T22:27:26Z")

</div>

Alternatively, you could have done something like

```auto
SELECT * FROM bds WHERE country = 'Ivory Coast' SORT BY plateforme.keyword ASC

```

---

<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:** [March 21, 2019, 10:27pm UTC](https://discuss.elastic.co/t/canvas-bar-charts-bars-not-always-displaued-in-the-same-order/169253/7 "2019-03-21T22:27:33Z")

</div>

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