1 Reply Latest reply on Jan 21, 2010 12:18 PM by Cr99

    showDataEffect infinite loop

    Cr99 Level 1

      Ok, for some reason my charting app has started displaying some really weird behavior.  It draws fine on the initial load, but if the user hit's reload (to look at a different time frame for example, it seems to redraw itself over and over again.  If I disable the showDataEffect animation, there is no noticeable effect, but if I leave it in, it just draws itself over and over in an infinite loop.  I used data binding to detect changes in the underlying data and those are what should be triggering the change animation.  In earlier versions, the animations were working and not exhibiting this strange loop behavior, but I can't seem to get it to go away now.  Here is some of the code.  Can anyone please help me fix this bizarre behavior? 

       

      // Actionscript

       

      var genericChart:LineChart = new LineChart();

      var axisList:ArrayCollection = chart.getAxisList();

                  var renderers:ArrayCollection = new ArrayCollection();

                  var seriesArray:ArrayCollection = new ArrayCollection();

                  var hAxis:DateTimeAxis = new DateTimeAxis();

       

                  // define each axis

          for (var i:int=0; i<axisList.length; i++) {

          var axis:AxisObject = axisList.getItemAt(i) as AxisObject;

          if (axis.getID() == "x Axis") { 

      // set to hours, weeks, etc.

      hAxis.labelUnits = axis.getAxisUnits().toLowerCase();

      hAxis.labelFunction = fullTimeLabelFunction;

       

              // more formating of the horizontal axis

          var ar:AxisRenderer = new AxisRenderer();

          ar.axis = hAxis;

          ar.setStyle("canDropLabels", "true");

          genericChart.horizontalAxisRenderers = [ar];

          genericChart.horizontalAxis = hAxis;

          }

          else {

      // Define vertical axis

              var vAxis:LinearAxis = new LinearAxis();

              vAxis.baseAtZero = false;

                  vAxis.title = axis.title;

       

       

      // more formatting of the axis

              var axr:AxisRenderer = new AxisRenderer();

          axr.axis = vAxis;

          // flip left axis

          if (axis.getLocation() == "left") {

          axr.setStyle("verticalAxisTitleAlignment", "vertical");

          }

          axr.setStyle("canDropLabels", "true");

          axr.setStyle("tickPlacement", "none");

          var colRatio:Number = 1.0/axis.getSeriesList().length;

          if (colRatio == 1.0) colRatio = 1.1;

         

          if (axisList.length == 2) genericChart.setStyle("gutterRight", 30);

         

              for (var j:int=0; j<axis.getSeriesList().length; j++) {

              var ser:SeriesObject = axis.getSeriesList().getItemAt(j) as SeriesObject;

            

              var col:uint = new uint(new Number(ser.getColor()));

              var stroke:Stroke = new Stroke();

             

              stroke.color = col;

             

              var columnSeries:ColumnSeries = new ColumnSeries();

       

      //****************************************      

           // when I reload, I set oldData.pointlist = newData.pointlist

              BindingUtils.bindProperty(columnSeries, "dataProvider", ser, "pointList");

      //****************************************

              columnSeries.columnWidthRatio = colRatio;

              columnSeries.verticalAxis = vAxis;

              columnSeries.displayName = ser.name;

             

              stroke.weight = 1;

              columnSeries.setStyle('stroke', stroke);        

              columnSeries.setStyle("fill", stroke.color);

              columnSeries.xField="point1";

              columnSeries.yField="point2";

              columnSeries.setStyle("showDataEffect", slideLeft);

              seriesArray.addItem(columnSeries);

             

              }

              renderers.addItem(axr);

          }

          }

          genericChart.series = seriesArray.toArray().reverse();

          genericChart.verticalAxisRenderers = renderers.toArray();

         

          genericChart.percentWidth = 100;

      genericChart.seriesFilters = [];  

         genericLegend.dataProvider = genericChart;

      genericLegend.direction = "horizontal";

         genericLegend.setStyle("direction", "horizontal");

         genericChart.showDataTips = true;

         

              }

             

         chartPanel.title = chart.getName();

         chartPanel.horizontalScrollPolicy = "off";

         

      chartPanel.addChild(genericChart);

       

      if (chart.getChartOptions().getShowLegend()) {

      var legendBox:HBox = new HBox();

      chartPanel.addChild(genericLegend);

      BindingUtils.bindProperty(genericLegend, "width", genericChart, "width");

       

       

       

      /////////////////////////////

       

      <!-- mxml data animation definition -->

      <mx:SeriesSlide

          duration="1000"

          direction="up"

          minimumElementDuration="200"

          elementOffset="30"

          id="slideUp/>

        • 1. Re: showDataEffect infinite loop
          Cr99 Level 1

          Ok, I found out what the problem is.  I had recently switched to compile this project under 3.4.  I switched it back to 3.3 and it draws fine just like it used to.  So definitely a bug with 3.4.  Hope this gets fixed in the future!