7 Replies Latest reply on Dec 16, 2010 9:28 AM by claytongulick

    Flex dynamic chart animation

    ramace Level 1

      Hi,

       

      Is it possilbe to add animations to dynamically created charts ?

       

      I tried giving series slide but was not successful.

       

      Is there an link which I can follow.

       

      Thanks in advance

        • 1. Re: Flex dynamic chart animation
          Fis Forums Level 1

           

           

           

           

          Use this code under

          <piechart>

              <pieseries>

                  <series>

           

                      <mx:showDataEffect>

           

           

           

           

           

           

          Note : Use any one of the property inside showtdataeffect tag

           

                        <mx:SeriesSlide duration="1000"/>

           

           

           

           

           

           

           

                        <mx:SeriesZoom duration="2000"/>

           

           

           

           

           

           

           

                        <mx:SeriesInterpolate duration="2000"/>

           

           

           

           

           

           

           

                    </mx:showDataEffect>

           

           

           

           

           

           

           

           

                </series>

            </pieseries>

           

           

            </piechart>

           

          • 2. Re: Flex dynamic chart animation
            ramace Level 1

            yes, this is possible only when I am creating chart in mxml.

             

            but the problem I am facing is my entire chart is created in actionscript and I tried these showdataeffect in actionscript but didn't work for me.

             

            Thanks for the reply.

            • 3. Re: Flex dynamic chart animation
              ramace Level 1

              Does any one have the solution for this ?

               

              Thanks in advance.

              • 4. Re: Flex dynamic chart animation
                rgadiparthi Level 2

                try this

                 

                seriesId.setStyle("showDataEffect", myAnimation);

                 

                 

                <mx:SeriesInterpolate id="myAnimation" duration="1000" />

                • 5. Re: Flex dynamic chart animation
                  ramace Level 1

                  Hi,

                   

                  After a lot of trial and errors, I finally got it working.

                   

                  The problem was, as my chart was getting created through actionscript so the effect was not visible.

                   

                  i.e: The code was doing something like this

                   

                  <instantiate a chart>

                  <set dataprovider for chart>

                  <add series to chart>

                  <add showDataEffect to series>

                  <add the chart to parent>

                   

                   

                  The working code looks somewhat like this.

                   

                  <instantiate a chart>

                  <add series to chart>

                  <add showDataEffect to series>

                  <add the chart to parent>

                  <set some timeout say 1000 ms>

                  <set dataprovider for chart> --- the catch

                   

                  This worked for me

                   

                  Thanks for all ur contributions

                  • 6. Re: Flex dynamic chart animation
                    trisweb2 Level 1

                    Thank you for this post - I would have spent hours trying to figure out that you need a delay before setting the dataProvider.  It turns out that the delay required is not a time, but simply a frame. So using callLater() works perfectly for this situation:


                    var animation:Effect = new SeriesInterpolate();

                    animation.duration = 500;

                    series.setStyle("showDataEffect", animation);

                    callLater(setDataProvider);

                    ...

                    private function setDataProvider():void {

                        chart.dataProvider = chartProvider;

                    }

                     

                    Thanks again, very useful info.

                    • 7. Re: Flex dynamic chart animation
                      claytongulick Level 1

                      Thanks for the callLater tip, solved a brutal bug.