Working with trend data

My customer is upgrading to Ignition from Citect (an old, old version of Citect). On the Citect trend screen there is a button for displaying the min, max and average of all the pens on the trend object. They would like to retain this functionality in Ignition, but I need some direction on how to access the data on the easychart object so I can run math functions. Can someone point me in the right direction. Thanks.

PJ Gonzales

Look at Calculated Pens in the in the Easy Chart Customizer. Right click on an Easy Chart in the designer -> Customizers -> Easy Chart Customizer. Then add a Calculated Pen. In the window that displays look at the Function dropdown.

With that you can make pens that are averages, min, max of other pens.

The data for pens on the Easy Chart come from datasets on the the Easy Chart.

So you could put a script on a button that creates the appropriate calculated pens and sets them in the Calculated Pens dataset.

Best,

Sorry to bump this old conversation, has anybody been able to do what OP needed? I am able to configure calculated pens but I would like to calculate min/max/average of all pens displayed on an easy chart. Thanks!

Okay so I was kind of able to get this done but not quite the way I wanted. I’m not quite sure how to explain it, but Ill do my best here.

  1. I created a Custom Property on my root container of type Dataset.

  2. I created a Container (Ill call it the aggregate container from here on) with visibility off. This container will be displayed when I press a Calculate Aggregates button.

  3. I made a button (Ill call it Calculate Aggregates from here on) that would populate my custom dataset with the data from the Easy Chart and display the aggregate container.

  4. On the button I used a script similar to this one (adjust it as necessary):

event.source.parent.getComponent("Aggregate Container").visible = 1
chart = event.source.parent.getComponent('Easy Chart').exportDatasets()
event.source.parent.parent.CUSTOM_DATASET = chart[0]

The first line sets visibility for your aggregate container on to display the “pop up”

The CUSTOM_DATASET will be the path to your own custom dataset property. The ‘exportDatasets()’ function will export the data from the Easy Chart into columns in your custom dataset property.

  1. In the aggregates container I created three numerical displays who values were Expression types. Three to be exact, min, max and average. These displays point back to columns in the custom dataset, which has now been populated with Easy Chart data, and runs a math function on it:
max(Root Container.Custom Dataset), "<column name>")
min(Root Container.Custom Dataset), "<column name>")
mean(Root Container.Custom Dataset), "<column name>")

The aggregates are re-calculated any time the calculate aggregates button is pressed to open the aggregate container. If the container is closed and the Easy Chart updated, pressing the Calculate Aggregates button again will repopulate the custom dataset with new data and recalculate the aggregates.

This was done a looooong time ago (original post was in 2015) and if I wanted to fool around with it again I’m sure the entire process could be tweaked to eliminate a number of steps. For example I’m sure the aggregates could be updated automatically when data on the Easy Chart was changed instead of having to use a button to initiate recalculations and all that.

I hope this was a sufficient explanation. It would be much easier if I could just SHOW you what I am doing, but I hope this can help you get started.

Thank you! That helped me figure out a solution.