# Ezchart pen disable script

**URL:** <https://forum.inductiveautomation.com/t/ezchart-pen-disable-script/3625>\
**Category:** Ignition\
**Created:** [November 18, 2011, 7:33pm UTC](https://forum.inductiveautomation.com/t/ezchart-pen-disable-script/3625 "2011-11-18T19:33:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [November 18, 2011, 7:33pm UTC](https://forum.inductiveautomation.com/t/ezchart-pen-disable-script/3625/1 "2011-11-18T19:33:29Z")

</div>

Script only disables the last row. All other rows previous does not disable. If more tags are selected, same thing happens, only the highest row pen disables. Row count prints out contiguous from 0-n.

`table = event.source.parent.getComponent("ezchart")
for row in range(table.tagPens.rowCount):
       newdata = system.dataset.setValue(table.tagPens, row, "ENABLED", 0)
       print row
table.tagPens=newdata
ezchart=table`

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 18, 2011, 8:06pm UTC](https://forum.inductiveautomation.com/t/ezchart-pen-disable-script/3625/2 "2011-11-18T20:06:28Z")

</div>

Hard to tell what you have going on without indentation, but this works for me:

`table = event.source.parent.getComponent("ezchart")
olddata=table.tagPens
for row in range(table.tagPens.rowCount):
	newdata = system.dataset.setValue(olddata, row, "ENABLED", 0)
	print row
	table.tagPens=newdata
	olddata=newdata
	`  
I used one more copy of the dataset. After writing to the ezchart, I copy the modified dataset into the old set. That keeps it internal to the script.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [November 18, 2011, 8:15pm UTC](https://forum.inductiveautomation.com/t/ezchart-pen-disable-script/3625/3 "2011-11-18T20:15:48Z")

</div>

Thank you, it works. Now I see what I did wrong.
