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

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

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”, 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.

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.

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

1 Like

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.

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:

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.

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.