Easy Chart Pen Frame Title

I wasn’t sure how to describe the component I’m inquiring about in the subject so I attached an image. Is there any way to link this title to a tag? I had trouble finding where this property is defined.

Thanks in advance.

I don’t believe it’s easy to bind it, but I can at least point out where it comes from: Each pen can belong to a “group”. The groups define how the pens get broken up over there. If you go to the chart customizer (where the pens are defined), select a pen and hit “Edit”, you should see the group setting for the particular pen. You can change them to fit what you want.

Hope that helps,

It depends on what you’re trying to do. Here’s what you can do with Easy Charts:

  1. Those Groups of pens (including labels) are created by unique values in the GROUP_NAME property of the Pens dataSet. You can view or edit this value as an Expert Property of the Easy Chart component. This property is bindable - so you can populate your pens (and group names) dynamically from an SQL query. The typical usage for this advanced technique is allowing “click to charts” or customizable profiles.

Alternatively, you could also edit the group names via Script.

  1. Another Easy Chart feature is Dynamic Groups, accessible via the Customizer. This allows you to filter pens by a custom WHERE clause based on group names. In this case you need to define group names ahead of time.

I would simply alter the group name in the pens dataset via a script.

An old trick comes up again! Create a dynamic property, bind that property to your driving tag/expression, then run the script on a value change.

For example:

  1. Create a (string) dynamic property called label on the parent container of the Easy Chart named Easy Chart.
  2. Bind label to your tag
  3. With the parent container selected, configure action->select the propertyChange event.

if event.propertyName=='label': #our dynamic property changed chart=event.source.getComponent('Easy Chart') row=0 #target pen (row in dataSet) #Set the chart's 'pens' dataSet to a new one #after modifying the GROUP_NAME property at row 0 chart.pens=fpmi.dataset.setValue(chart.pens, row, "GROUP_NAME", event.newValue)
*note: you will need to loop through each pen with the same group name

Thank you all for your suggestions. Nathan, I will be using your scripting approach. However, I am receiving the following error when my script is executed

Traceback (innermost last):
File “event:propertyChange”, line 14, in ?
AttributeError: instance of ‘com.inductiveautomation.factorypmi.application.script.BuiltinPackage’ has no attribute ‘dataset’

which is referring to:

chart.pens=fpmi.dataset.setValue(chart.pens, row, "GROUP_NAME", event.newValue)

Is this dataset module a version 3.3 update?

Yep. You can find the change log here: inductiveautomation.com/supp ... FactoryPMI

Its the fifth entry down from the top.

Ok! The scripting approached worked well. I used the following approach to loop through the rows of the ‘pens’ dataset, in case anyone was going to be taking the same route as I.

if event.propertyName=='penLabel': #our dynamic property changed chart=event.source.getComponent('Easy Chart') data = fpmi.dataset.toPyDataSet(chart.pens) i=0 for n in data: chart.pens=fpmi.dataset.setValue(chart.pens, i, "GROUP_NAME", event.newValue) i=i+1