# How to Bind Sepasoft MES Analysis Dataset to Perspective Timeseries Chart?

**URL:** <https://forum.inductiveautomation.com/t/how-to-bind-sepasoft-mes-analysis-dataset-to-perspective-timeseries-chart/55217>\
**Category:** 3rd Party Modules\
**Tags:** ignition81\
**Created:** [January 20, 2022, 5:08pm UTC](https://forum.inductiveautomation.com/t/how-to-bind-sepasoft-mes-analysis-dataset-to-perspective-timeseries-chart/55217 "2022-01-20T17:08:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Calderon](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Daniel\_Calderon](https://forum.inductiveautomation.com/u/Daniel_Calderon)\
**Post date:** [January 20, 2022, 5:08pm UTC](https://forum.inductiveautomation.com/t/how-to-bind-sepasoft-mes-analysis-dataset-to-perspective-timeseries-chart/55217/1 "2022-01-20T17:08:18Z")

</div>

Hi All,

I am using Perspective MES Analysis selector to pull some data from OEE Downtime. I am connecting this data to an MES Analysis Table, and I am getting the results I want with an hourly timestamp.  
 ![mes table](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c1b4fd20defe04922b6470b7fba010858f296da0.png)

Now I would like to use this data in a perspective Timeseries bar chart. Since the type of data that the mes analysis selector returns is “[mes dataset](https://help.sepasoft.com/docs/display/SEPA/Analysis+Dataset)”, I am binding it to my chart series.data prop and doing a script transform to reshape the dataset to a list of objects I can plot in bars. This is working and I am able to create this new list.

 ![chart object](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c4be788e04e778f61fdee7b08cbc32dcd7e58fe0.png)

The problem I am having is the time key. The timestamp that comes in the mes dataset is a java.util.date _(Edit: I had java.util.time before)_ type which I have not been able to properly cast into a time format that the perspective prop can interpret and properly render the timeseries bars.

So I would like to know whether I am following the correct approach to connect MES results to Perspective charts, or there is a better/easier way to do it. If this is the only way, any help with the time key would be welcome.

Thanks All.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 20, 2022, 8:23pm UTC](https://forum.inductiveautomation.com/t/how-to-bind-sepasoft-mes-analysis-dataset-to-perspective-timeseries-chart/55217/2 "2022-01-20T20:23:07Z")

</div>

Does `java.util.time` class even exists? I think you mean `java.util.Date`

In that case, cast it to Unix Time with `.getTime()` method

---

<div class="post-metadata">

**Author:** ![Daniel\_Calderon](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Daniel\_Calderon](https://forum.inductiveautomation.com/u/Daniel_Calderon)\
**Post date:** [January 20, 2022, 9:57pm UTC](https://forum.inductiveautomation.com/t/how-to-bind-sepasoft-mes-analysis-dataset-to-perspective-timeseries-chart/55217/3 "2022-01-20T21:57:22Z")

</div>

Jonathan. You are correct, I typed the wrong class name on my post, and I have edited it to fix that.

Your method works perfectly. Thanks for that.

```python
value.getValueAt(r, col).getTime()

```

I also discovered that I can use this other function to just reformat as a string that perspective happily interprets as date:

```python
system.date.format(value.getValueAt(r, col), "yyyy-MM-dd HH:mm:ss")

```

Finally, for what it's worth, I was struggling with timeseries chart bars widths, until I found another post here with a nice explanation of how using XY chart provides much better flexibility to create bar charts.

> [@Stacked Bar Chart in Perspective - Detailed Steps](https://forum.inductiveautomation.com/t/stacked-bar-chart-in-perspective-detailed-steps/47107):
>
> Few months ago I needed to create a stacked bar chart and ran into issues ([Perspective 8.0.14 Time Series Bar Chart width - #3 by arun1](http://forum.inductiveautomation.com/t/perspective-8-0-14-time-series-bar-chart-width/37160/3)). There are few posts here but they don’t give a full picture. Here are the steps that I took to create one: First it is worthwhile to note that we need to use the XY chart and not the TimeSeries chart because the width of the bar chart is calculated automatically based on the amount of data in the x-axis so if you have sparse data in a wide time range then th…

So thanks a lot, I will mark this as solved. (Still sort of hoping Sepasoft team provides a more straightforward way to connect datasets with perspective charts.
