# Easy Chart - Calculated Pens

### Easy Chart - Calculated Pens

Watch the videoTo learn more, go to the Tag and Set up Tags to Log pages. The examples below use OPC tags from the Generic Simulator driver, but Memory, Expression, and Query Tags can be used instead.

Calculated pens display a value that is dynamically calculated based on another pen. This can be used to calculate certain values for a pen and graph them alongside the original pen values, allowing you to gain valuable insight into your data. There are many unique calculations that can be used, with some of them containing unique customization. Almost all of the Calculated pens require a driving pen, which is a tag or database pen that you have already set up.

You cannot bind the Calculated Pen values inside the Easy Chart Customizer. To bind the function values, use the Cell Update Binding.

Function | Display Name | Description | Extra Properties |
---|---|---|---|

Constant | Constant | A constant value on the chart. | Constant Value - The constant value of the pen. |

Upper Control Limit | UCL | The upper control limit of the driving pen, which is three standard deviations above the mean of the Driving Pen | |

Upper Warning Limit | UWL | The upper warning limit of the driving pen, which is two standard deviations above the mean of the Driving Pen | |

Average | Avg | The average of the driving pen. | |

Lower Warning Limit | LWL | The lower warning limit of the driving pen, which is two standard deviations below the mean of the Driving Pen | |

Lower Control Limit | LCL | The lower control limit of the driving pen, which is three standard deviations below the mean of the Driving Pen | |

Moving Average | MovingAvg | A series of averages based on subsets of the driving pen. The subsets are determined by the window size. | Window Size - The size of the moving average window, specified as a multiplier of the chart's date range. |

Multiply Pen | Multiply | Multiply each data point of the driving pen by a factor. | Factor - The factor that each data point of the driving pen is multiplied by. |

Minimum Value | Min | The minimum value of the driving pen. | |

Maximum Value | Max | The maximum value of the driving pen. | |

Running Sum | RunningSum | A running sum or running total of the driving pen. | |

Sum | Sum | The sum of two different driving pens. | Secondary Pen - The second driving pen. |

Difference | Difference | The difference of two separate driving pens. | Secondary Pen - The second driving pen. |

Linear Regression | LinearRegression | New in 7.9.4 Will create a linear regression line for the driving pen. |

### Example - Creating Calculated Pens

Right click on the Easy Chart component, and scroll down to

**Customizers > Easy Chart Customizer**.The Pens tab will open and you'll notice a

**Calculated Pens Table**at the bottom of the screen. You can add one or more calculated pens by clicking the**green plus icon**.Add a calculated pen name called '

**High SP**.' In the Function field, select '**Constant**' from the dropdown list, and set the 'Constant Value' at '**25**.' Click**OK**.noteCalculated pens are just like other pens, so you can specify the style, color, axis and subplot in the Edit Pen window.

Press

**OK**again to view your High SP pen on your Easy Chart. The High SP value of 25 is represented on your Easy Chart by a blue horizontal line.Let's add a second calculated pen. On the

**Pens**tab, click the**green plus icon**on the Calculated Pens Table.On the

**Edit Pen**window, enter the calculated pen name called '**Moving Average.**' In the Function field, select '**MovingAvg**' from the dropdown list. Set the Driving Pen to '**Realistic1**,' also from the dropdown list. (If you have more Tags that you dragged on to your Easy Chart from the Tag Browser, you'll have more pens to choose from in the Driving Pen dropdown list).Specify the

**Window Size**which is the percentage of the total time period that you are going to do a Moving Average on, for example**20%**. Press**OK**.Let's add two more calculated pens: one for Upper Control Limit (

**UCL**) and another for Lower Control Limit (**LCL**), and set the Driving Property to '**Realistic1**.'Once you added all your calculated pens, you'll see all your pens in the Calculated Pens Table at bottom of the window. Press

**OK**.Now, all your calculations are displayed on your Easy Chart. The blue pen is the Constant, the pink pen is the Moving Average, and UCL and LCL are brown and green respectively.

Once you have your Calculated Pens created, you'll notice that hey disappear if you disable the pen driving them. If you want to remove the Driving Pen but leave the Calculated Pens, set the **Hidden** property of the Driving Pen.