Easy Chart Show/Hide Pens

No worries.

You are having a scope issue. The variable displaygroup is not defined outside of the if and else statements.

I would change your code slightly to avoid this, something like:

# grab the tag pen datset for modification
chartdata = event.source.parent.getComponent('Easy Chart').tagPens

selgroup = {"HIDDEN":0,"ENABLED":1}
hidegroup = {"HIDDEN":1,"ENABLED":0}
newgroup = {"HIDDEN":0,"ENABLED":0}
# use button name as group name
selgroupname = event.source.text


# Check each new row in dataset
for row in range(chartdata.rowCount):
	groupname = chartdata.getValueAt(row,"GROUP_NAME")
	#assign new parameters based on selected group
	if groupname == selgroupname: #groupname is equal to button selected
		chartdata = system.dataset.updateRow(chartdata,row,selgroup)
	else: # uncommentsection to hide other groups
		chartdata = system.dataset.updateRow(chartdata,row,hidegroup)
# update tag pen dataset in chart		
event.source.parent.getComponent('Easy Chart').tagPens = chartdata
1 Like