I am attempting to add/remove plots on a TimeSeriesChart with a script that builds the plots array with a changescript on the parameter NumberValues.
The script works perfectly when in designer, but throws a type error exception when I try to append to the plots property in runtime.
Some help on this would be much appreciated, or an explanation of why it will not work.
Thanks!
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
numbervalues = self.params.NumberValues
system.perspective.print("numbervalues" + str(numbervalues))
plots = self.getChild("root").getChild("FlexContainer").getChild("TimeSeriesChart").props.plots
system.perspective.print("beginninglen" + str(len(plots)))
plottemps = self.custom.PlotTemplates
plotslen = len(plots)
plot1 = plottemps[0]
plot2 = plottemps[1]
plot3 = plottemps[2]
while plotslen > 0:
del plots[plotslen - 1]
plotslen -= 1
system.perspective.print("deletedlen" + str(len(plots)))
while numbervalues > 0:
system.perspective.print("loopvalues" + str(numbervalues))
try:
plots.append(plottemps[numbervalues - 1])
except:
e = sys.exc_info()[0]
system.perspective.print(e)
numbervalues -=1
system.perspective.print("rebuiltlen" + str(len(plots)))