I have an EasyChart and I want a single button to reset 6 pens to their default colors. I already have the Hex code for their colors. I also have code that will change to color of a single pen. I am not strong with Python scripting at all. Somebody please help me out.
THIS CODE WORKS:
pens = event.source.parent.getComponent(‘Easy Chart’).tagPens
newDS = system.dataset.setValue(pens, 0, “COLOR”, “FF5555”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
THIS CODE DOESN’T WORK: (I think I know why)
pens = event.source.parent.getComponent(‘Easy Chart’).tagPens
newDS = system.dataset.setValue(pens, 0, “COLOR”, “FF5555”)
newDS = system.dataset.setValue(pens, 1, “COLOR”, “FF5555”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
So since that code didn’t work, I tried this.
THIS CODE DOESN’T WORK EITHER: (I have no idea why not)
pens = event.source.parent.getComponent(‘Easy Chart’).tagPens
newDS = system.dataset.setValue(pens, 0, “COLOR”, “FF5555”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
newDS = system.dataset.setValue(pens, 1, “COLOR”, “5555FF”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
newDS = system.dataset.setValue(pens, 2, “COLOR”, “55FF55”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
newDS = system.dataset.setValue(pens, 3, “COLOR”, “FF55FF”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
newDS = system.dataset.setValue(pens, 4, “COLOR”, “55FFFF”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS
newDS = system.dataset.setValue(pens, 5, “COLOR”, “FFAFAF”)
event.source.parent.getComponent(‘Easy Chart’).tagPens = newDS