1 Reply Latest reply on Jan 27, 2012 4:29 AM by allanjard

    Chart - x-axis label positions

    allanjard Level 1

      Hello all,

       

      I'm having a bit of difficulty making a NumericAxis show labels where I want it to. There is the 'ticks' property of the NumericAxis, but this is read only, so I have no idea how to set where I want labels to appear.

       

      Specifically, this screen shot shows the problem I am seeing: http://sprymedia.co.uk/media/misc/flex/chart_axis.png . I'd really like to have a label at the bottom of the y-axis, rather than somewhere off it. I've set the 'minimum' value for the NumericAxis, the maximum and the interval, but I just don't seem to be able to control the position that the ticks (and therefore the labels) show. Is this possible?

       

      Many thanks,

      Allan

        • 1. Re: Chart - x-axis label positions
          allanjard Level 1

          Been diging throught he charts source to figure out if there is a way of doing what I wanted, and appartntly there is (well - for the most part). For anyone else interested there is a property called alignLabelsToInterval for the LinearAxis class. This is not documented but it is a public variable - in the code ( http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/charts/src/m x/charts/LinearAxis.as ):

           

          /**

          * @private

          */

          public function get alignLabelsToInterval():Boolean

          {

          return _alignLabelsToInterval;

          }

          /**

          * @private

          */

          public function set alignLabelsToInterval(value:Boolean):void

          {

          if (value != _alignLabelsToInterval)

          {

          _alignLabelsToInterval = value;

          invalidateCache();

          dispatchEvent(new Event("mappingChange"));

          dispatchEvent(new Event("axisChange"));

          }

          }

           

           

          Setting this parameter to false allows the base label to stay on the origin of the chart. Then you need to compute a suitable interval for the axis to get the labels you want.

           

          Phew!

           

          Allan