0 Replies Latest reply on Aug 10, 2009 4:10 AM by dr.Evol

    Charting: Displaying two axis and overriding axis.filterCache




      I'm trying to create a chart with two axis. The first is categoryAxis and the second is linearAxis. The aim of the second one is to display a horizontal limit line for data shown on categoryAxis.


      For the linearAxis I need to display a constant limit line which is defined only by two points (date/value pair). I want to show the line even if the minimum and maximum properties of the linearAxis is set in the range which is narrower than the two data points of the limit line.

      Normally, the line would not be rendered at all since axis filters out the points which are outside the visible range.

      For that purpose, I have createda custom axis which overrides the filterCache method in order to persist the data points for rendering the line even if it is outside the visible range.


      That works, but only if the custom axis is placed on chart.horizontalAxis.

      If placed on lineSeris.horizontalAxis, it's filtering still works as expected but the line is not rendered.


      I'm not familiar with the in-depth architecture of the charting components but obviously the axis declared in lineSeries.horiznotalAxis behaves differently as being declared in chart.


      Here is the example of the custom axis:


          import mx.charts.LinearAxis;


           * This Axis type allow the chart to draw lines even if the points are outside the min/max range.
           * @author borja
          public class OutRangeLinearAxis extends LinearAxis
              public var actualMin:Number;
              public var actualMax:Number;
              public function OutRangeLinearAxis()
              override public function filterCache(cache:Array, field:String, filteredField:String):void
                   var compMin:Number = computedMinimum;
                  var compMax:Number = computedMaximum;
                  computedMinimum = actualMin;
                  computedMaximum = actualMax;
                  super.filterCache(cache, field, filteredField);
                 computedMinimum = compMin;
                  computedMaximum = compMax;
                  trace("min="+new Date(computedMinimum));
                  trace("max="+new Date(computedMaximum));




      Any help would be appreciated. Thanks!