1 Reply Latest reply on Dec 11, 2009 1:34 PM by Cr99

    Areaseries tooltip odd behavior

    Cr99 Level 1

      I have a charting app that takes some generic Actionscript objects and unpacks them as charts.  The data is stored in a class with:

       

       

       

      public var point1:Object;

      public var point2:Object;

       

      Pretty straight forward and the app works fine except for the tooltips.  All of the tooltips display correctly for lines, plots, and columns like this:

       

      tooltipGood.png

       

      But not for Areaseries!  Instead with areaseries, I get:

       

      tooltipBad.png

       

      See the "point1" label?  Where is that coming from?  I set up all of the series the same way (or so I thought) so I can't figure out the source of this anomaly.

       

      Here is the relevant code:

       

      // genericChart is a CartesianChart

       

      var renderers:ArrayCollection = new ArrayCollection();

      var seriesArray:ArrayCollection = new ArrayCollection();

      var hAxis:DateTimeAxis = new DateTimeAxis();

                 

      hAxis.displayLocalTime = true;           

      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;

      // Define vertical axis

      var vAxis:LinearAxis = new LinearAxis();

      vAxis.baseAtZero = false;

      var axr:AxisRenderer = new AxisRenderer();

      axr.axis = vAxis;

       

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

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

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

      if (colRatio == 1.0) colRatio = 1.1;

       

      if (type == "line") {

           var lineSeries:LineSeries = getLineSeries();        

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

           stroke.weight = 3;

           lineSeries.verticalAxis = vAxis;

           lineSeries.horizontalAxis = hAxis;

           lineSeries.displayName = ser.name;

           lineSeries.setStyle("lineStroke", stroke);

           lineSeries.xField="point1";

           lineSeries.yField="point2";        

           seriesArray.addItem(lineSeries);     

      }

      if (type == "column") {

           var columnSeries:ColumnSeries = getColumnSeries();        

           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";

           seriesArray.addItem(columnSeries);

      }

      if (type == "area") {

           var areaSeries:AreaSeries = new AreaSeries();

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

           areaSeries.verticalAxis = vAxis;

           areaSeries.horizontalAxis = hAxis;

           areaSeries.displayName = ser.name;

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

           var aColor:SolidColor = new SolidColor(colNum, 0.4);

           var aStroke:Stroke = new Stroke(col, 3,0.4);

           areaSeries.setStyle("areaStroke", aStroke);

           areaSeries.setStyle("areaFill", aColor);

           areaSeries.xField="point1";

           areaSeries.yField="point2";

           seriesArray.addItem(areaSeries);

      }

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

      genericChart.verticalAxisRenderers = renderers.toArray();