Skip navigation
Ajay Prabhakar Barokar
Currently Being Moderated

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

Apr 10, 2013 6:20 AM

Tags: #data #as3 #flex #actionscript #component #flex-4.6 #actionscript_3.0 #flex2 #flex4.5 #flex3 #flex4.6 #flex2.1

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.

 
Replies
  • Currently Being Moderated
    Apr 15, 2013 10:20 AM   in reply to Ajay Prabhakar Barokar

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points