2 Replies Latest reply: Apr 16, 2013 8:59 PM by Ajay Prabhakar Barokar RSS

    How to Control number of minorticks between two ticks of axis ?

    Ajay Prabhakar Barokar Community Member

      Hi Guys,

      I want draw number of minor ticks between two ticks of vertical axis of column chart based on user input.

      ex:if user is providing 2 there should be two minor ticks between two ticks of axis.

      Thanks in advance.

        • 1. Re: How to Control number of minorticks between two ticks of axis ?
          DeanLoganBH Community Member

          From what I can tell with fooling around with it, the minorInterval value divides the vertical count to give the appropriate number of ticks between each interval.

           

          <mx:LinearAxis id="countAxis" alignLabelsToInterval="true" 
                autoAdjust="true" minorInterval="2" 
                minimum="0" interval="10"
                maximum="100">
          </mx:LinearAxis>
          

           

          In the example above, I have the interval at 10 and when I set the minorInterval to 2, then I get 5 ticks.  The first tick is at the interval and then followed by 4 more ticks.

           

          In your example, in order for me to see 2 ticks between the intervals, then I would have to set the minorInterval to 3.5 .

           

          10 / 3.5 = 3 (2 ticks)

           

          The forumla would have to be something like:

          ViewableTicks = Interval / (Selected Ticks + 1);

           

          So, if I created a droplist, with 1 - 9 ticks (because 0 doesn't work if you are showing minor ticks), then when the option is changed, I would calculate the value for the minor ticks and set the LinearAxis component (countAxis) to that new value.

          protected function tickViewList_changeHandler(event:IndexChangeEvent):void
          {
           var tickCount:int = tickViewList.selectedItem;
           var tickView:Number = countAxis.interval / (tickCount + 1);
           countAxis.minorInterval = tickView;
          }
          
          

           

          I created a blog post showing my example.

          ColumnWithIntervalTicks_2ticks.pngColumnWithIntervalTicks_4ticks.png

          Message was edited by: DeanLoganBH - add blog post link with example pictures

          • 2. Re: How to Control number of minorticks between two ticks of axis ?
            Ajay Prabhakar Barokar Community Member

            Thanks This code is useful for displaying the number of minor ticks between major ticks ., but making minor tick length to chart width is not useful for me .my problem is to set different color to minor ticks and the minor grid lines.