1 Reply Latest reply on May 2, 2012 10:39 AM by JorAndra026

    Create checkbox from Chart in ActionScript

    JorAndra026

      Hi all. Have a little problem hope someone has already solved it.

       

      So i have 2 ArrayCollections with a same format but diferent data:

       

      public var santiagoPast:ArrayCollection = new ArrayCollection([

                {Month:"Ene", Fee:1000, Kiosco:10, Web:256, Movil:87, No_detectado:6, Sin_informacion:10},

                ........

                {Month:"Dic", Fee:195, Kiosco:320, Web:100, Movil:33, No_detectado:5, Sin_informacion:5}  

      ]);

       

      public var santiagoNow:ArrayCollection = new ArrayCollection([

                                  {Month:"Ene", Fee:800, Kiosco:10, Web:256, Movil:87, No_detectado:6, Sin_informacion:10},

              ......

                                  {Month:"Abr", Fee:600, Kiosco:78, Web:234, Movil:78, No_detectado:32, Sin_informacion:8}

      ]);

       

      So with them, i create a Multi data chart via ActionScript. The first data: "santiagoPast" will be LineSeries and the second one: "santiagoNow" will be ColumnSeries.

       

      Then, also via ActionScript i create a checkbox for each serie. That way, the user can check or uncheck to show or hide that serie in the chart.

       

      Im trying to not to create a checkbox for the ColumnSerie, but the only way that ir works is when i create a checkbox for all the series. The code where i create the checkbox is this:

       

      private function crearcheckbox():void{

                 

                            for each(var serie:Series in linechart.series){

                                      var combo:CheckBox = new CheckBox();

                                      combo.data = serie;

                                      combo.id = serie.id;

                                      combo.label = combo.data.yField;

                                      combo.addEventListener(Event.CHANGE, cambio);

                                      comboboxes.addChild(combo);

                            }

                  }

       

       

      And i tried changing the for each(var serie:Series in linechart.series) to for each(var serie:LineSeries in linechart.series) but doesnt work.

       

      Any ideas?

       

      Thanks for your time!