Button to remove all pens from easy chart

I am trying to make a trend window on my ignition dashboard. I am using the tag browser to pull pens into the chart, but I do not like the way you have to natively remove the pens with the "x". I want to disable pen control, and add a button that will clear all the pens off the chart.

Consider using Legends instead of the pen control subwindow (it can be disabled).

I am using legends, but there is no way to remove pens from the trend with legends.

Yes, you can remove the row from the tagPens or pens dataset property of the EasyChart. That removes the pen. (Yes, you will need a button of your own to script it.)

I often group the pens and have multiple buttons along the top that show/hide the different groups using scripting. Something along the lines of

#grab all pens from the chart. this will be edited and then stored back to the chart
data = event.source.parent.getComponent('Easy Chart').pens

#define show/hide states
showGroup = {"HIDDEN":0, 'ENABLED':0}
hideGroup = {"HIDDEN":1, 'ENABLED':0}
newGroup = {"HIDDEN":0, 'ENABLED':0}

#selected group matches button text
selectedGroupName = event.source.text

#custom property
shown = event.source.showGroup

#initialize row at row 0
row = 0

#if group is currently being shown
if shown:
	#for each pen in the chart
	for row in range(data.rowCount):
		#get group name for pen
		groupName = data.getValueAt(row,"GROUP_NAME")
		#if group name matches button text
		if groupName == selectedGroupName:
			#hide group
			data = system.dataset.updateRow(data,row,hideGroup)
			#set custom property to false (group is hidden)
			event.source.showGroup = False
#group is currently being hidden
else:
	#for each pen in the chart
	for row in range(data.rowCount):
		#get group name for pen
		groupName = data.getValueAt(row,"GROUP_NAME")
		#if group name matches button text
		if groupName == selectedGroupName:
			#show group
			data = system.dataset.updateRow(data,row,showGroup)
			#set custom property to true (group is shown)
			event.source.showGroup = True

#write the re-configured pens dataset back to the chart
event.source.parent.getComponent('Easy Chart').pens = data

In this example the button text matches the group name.