0 Replies Latest reply on Dec 11, 2008 2:45 PM by shawnyale

    Clean way to regenerate Chart Series

    shawnyale Level 1
      Hi all,
      I've got a Chart that has its series generated at runtime based upon whatever data is returned from a webservice. Now here's the thing, I will never know how many series are in the data until runtime. And depending on the individual webservice, two sets of data could be entirely different.

      Now, I've got my chart to create the series dynamically, but its based on looping through the data to figure out how many series are needed, then looping through the data provider to determine which objects go with which series, adding an effect for the showDataEffect and hideDataEffect on the series, and then rendering the series to the chart.

      When another call is performed, the data completely changes and I have to pop() the series off the chart.series array or I end up with residual chartItems. When I pop the series, I get no data effect. I have also tried to use the hideEffect/showEffect, etc but those dont work either. What I would like is to have the data cleanly transistion from one set to another but since everything is recreated each time, I'm not sure if this is possible.

      Seems like all those loops are just ugly and I hate ugly code.

      Any thoughts?