# Easy Chart - Unit Conversion on Tag History

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 12, 2021, 5:54pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419 "2021-03-12T17:54:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [March 12, 2021, 5:54pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/1 "2021-03-12T17:54:01Z")

</div>

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).

Is this possible?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 12, 2021, 7:13pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/2 "2021-03-12T19:13:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [March 12, 2021, 8:17pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/3 "2021-03-12T20:17:59Z")

</div>

Thanks for the response. It’d be nice if there was an “expression” feature as well!

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 12, 2021, 8:30pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/4 "2021-03-12T20:30:00Z")

</div>

Yes, I requested that on the Ideas site a while back. You can vote for the idea here:  
[https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/support-equations-in-easychart-calculated-pens](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/support-equations-in-easychart-calculated-pens)  
And/or another similar one here that goes a step further:  
[https://inductiveautomation.canny.io/ignition-features-and-ideas/p/easy-chart-or-power-chart-virtual-pens](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/easy-chart-or-power-chart-virtual-pens)

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [March 12, 2021, 8:41pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/5 "2021-03-12T20:41:30Z")

</div>

Thanks for the links. I upvoted both.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [March 12, 2021, 8:59pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/6 "2021-03-12T20:59:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [March 12, 2021, 11:13pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/7 "2021-03-12T23:13:29Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [March 14, 2021, 2:41pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/8 "2021-03-14T14:41:57Z")

</div>

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.

---

<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:** [March 14, 2021, 4:08pm UTC](https://forum.inductiveautomation.com/t/easy-chart-unit-conversion-on-tag-history/44419/9 "2021-03-14T16:08:42Z")

</div>

That would be the Classic Chart. The OP is asking about the EasyChart.
