1 Reply Latest reply on May 28, 2007 1:00 AM by TimmyTears

    Switch between variable and fixed axis

    Delodic
      In my application I want a checkbox labeled: use fixed axis. When it's checked the chart's axis both get a maximum. But when you uncheck the checkbox the axis should get variabel again (which means, get rid of the maximum property).

      This is what I tried, but it doesn't work. You start with variable axis, and when you check the box the axis indeed will get fixed. But unchecking the checkbox will not get the axis variable again.

      quote:

      <mx:verticalAxis>
      <mx:LinearAxis id="vax" displayName="Healed / Mana"/>
      </mx:verticalAxis>
      <mx:horizontalAxis>
      <mx:LinearAxis id="hax" displayName="Healed / Time" />
      </mx:horizontalAxis>


      quote:

      public function fixAx():void
      {
      if (fix.selected) {
      vax.maximum = 1000;
      hax.maximum = 1200;
      } else {
      vax = new LinearAxis;
      hax = new LinearAxis;
      }
      }
        • 1. Re: Switch between variable and fixed axis
          TimmyTears
          Hi Delodic,

          To change back to a variable axis you need to set the maximum to NaN(not a number). this will tell the axis renderer to calculate the maximum itself. The update code is as follows:

          public function fixAx():void
          {
          if (fix.selected) {
          vax.maximum = 1000;
          hax.maximum = 1200;
          } else {
          vax.maximum = NaN;
          hax.maximum = NaN;

          }
          }

          Hope this helps