2 Replies Latest reply on Jul 1, 2009 1:28 AM by Moffly

    How to create a new chart at runtime

    Moffly

      I'm developing an application with several charts.

      Now I want after clicking a button a new chart to be created. I have tried to copy one of the charts but it didn't work.

      I tried something like this:

      public function addNewChart():void{
              var nueva:BarChart  = new BarChart;
               var myLegend:Legend = new Legend();
               var myPanel:Panel = new Panel();
               myLegend.dataProvider = barChart;
               myPanel.addChild(nueva);
               myPanel.addChild(myLegend);
               box1.addChildAt(nueva, 0);
           }