I’m seeing if it is possible to trend different units using an Easy Chart. For example, I have a tag (pressure in ‘psi’) that is stored in the historian. I have a request to be able to display the trend history in other units (such as ‘bar’). It seems like all of the calculated pen functions do things that are way more complicated than just multiplying the driving pen by a value (like an Expression tag).
The multiply function in a calculated pen–with your psi pen as the driving pen–should work as 1 psi = 0.0689475728 bar. You’re out of luck if you need a conversion with offset as well as proportion (such as temperatures). In that case, we’ve resorted to creating an expression tag with the alternate unit and historicizing it too, switching between history pens in runtime based on unit selection.
We work around this with some scripting.
On a data change event we build a second dataset of calculated values and write it out to a custom property dataset on the chart.
Then the pens on the chart also point to that custom property.
Takes a bit of code but it works.
@MMaynard Thanks for the idea. Where do you set up the data change event? I don’t see a “data” property on the Easy Chart (like a power table). In my case I have a trend on my generic transmitter popup (temperature, pressure, etc…) that displays the trailing ### time period.
What we do is create 2 dataset custom properties on the chart.
1 is the historical tag query the other is the calculated dataset.
Then in the PropertyChange event on the chart just look for the event name of the historical dataset.
For example:
You name the historical custom property as HistDS
Then in the scripting for PropertyChange you can do
if event.propertyName==‘HistDS’:
Code For Calculations/Add to other dataset
Then whenever the HistDS is updated, the code for the calculated dataset will run.