# TimeSeriesChart Sort Question

**URL:** <https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 30, 2023, 9:25pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321 "2023-05-30T21:25:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanleroux](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/juanleroux/32/11276_2.png) [@juanleroux](https://forum.inductiveautomation.com/u/juanleroux)\
**Post date:** [May 30, 2023, 9:25pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/1 "2023-05-30T21:25:44Z")

</div>

I have a TimeSeriesChart with one series defined with a single a dataset binding. The dataset is straight forward Column Time, Column ABC, Column TUV, Column XYZ. I would like my TimeSeriesChart to display the legend in the order of the dataset, however it appears to be random (or at least it appears that way). How do I set the sorting of the TimeSeriesChart?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2023, 9:42pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/2 "2023-05-30T21:42:27Z")

</div>

A time series chart, as its name suggests, is only for time series data. You must have a timestamp column and provide the dataset sorted by that timestamp.

---

<div class="post-metadata">

**Author:** ![juanleroux](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/juanleroux/32/11276_2.png) [@juanleroux](https://forum.inductiveautomation.com/u/juanleroux)\
**Post date:** [May 30, 2023, 9:44pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/3 "2023-05-30T21:44:14Z")

</div>

Hey. Apologies, updated the original post. The first column being a date/Time column.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2023, 10:06pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/4 "2023-05-30T22:06:27Z")

</div>

Do you have a `trends` property in `plots[0]` with the desired order in its `columns`? (Not sure if that will do it, but that is what I would try first.)

---

<div class="post-metadata">

**Author:** ![juanleroux](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/juanleroux/32/11276_2.png) [@juanleroux](https://forum.inductiveautomation.com/u/juanleroux)\
**Post date:** [May 30, 2023, 10:14pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/5 "2023-05-30T22:14:22Z")

</div>

I do have a trends property as suggested. However nothing that would suggest a sort option. Like I said in the original post the datsaset is sorted as desired. Attached a screenshot for reference.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/b/3bbb426d81d98584e03aabea2e48b1dbe5c76b02.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2023, 10:18pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/6 "2023-05-30T22:18:25Z")

</div>

You have no entries in `plots[0].trends[0].columns`. Consider [populating that](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Time+Series+Chart#PerspectiveTimeSeriesChart-Properties).

---

<div class="post-metadata">

**Author:** ![juanleroux](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/juanleroux/32/11276_2.png) [@juanleroux](https://forum.inductiveautomation.com/u/juanleroux)\
**Post date:** [May 30, 2023, 10:26pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/7 "2023-05-30T22:26:58Z")

</div>

Thank you very much, that was exactly what I was missing!

---

<div class="post-metadata">

**Author:** ![juanleroux](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/juanleroux/32/11276_2.png) [@juanleroux](https://forum.inductiveautomation.com/u/juanleroux)\
**Post date:** [September 12, 2023, 3:32am UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/8 "2023-09-12T03:32:47Z")

</div>

Your solution worked great for the first 8 coulmn entries. Thereafter, when I add another the sort order goes random again. I have confirmed my dataset column entries are correct, and matches the column key. Any thoughts on what could cause this behaviour?

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [November 22, 2023, 9:39pm UTC](https://forum.inductiveautomation.com/t/timeserieschart-sort-question/74321/9 "2023-11-22T21:39:54Z")

</div>

I have this issue when showing 8+ trends as well.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/c/9ce0accefdfc52857717bda57a06ae26610a82b3.png)
