See Also

Top  Previous  Next




array onNeedsTicks( float min, float max, EJSC.Axis axis, EJSC.Chart chart)




This event is triggered whenever the axis ticks need to be redrawn / recalculated.  It expects an array of [ float y, string label ] to be returned which defines exactly where to put the tick marks and labels.  In addition, null may be returned in order to skip custom ticks for the current draw and use the chart's build in tick controls.


               min: The current minimum value visible on the chart for the axis.

               max: The current maximum y value visible on the chart for the axis.

               axis: The axis which needs ticks.

               chart: The chart that triggered the event.




       To use the label formatter already assigned to the axis, set label to null (i.e. [min, null])
       To use on an axis with bins (text instead of numbers), simply send in the bin (i.e. ["First Bin", null])





A typical event handler may look like the following:


function doBottomAxisNeedsTicks(min, max, axis, chart) {


       // Display 3 tick marks, one at min, one at max and one directly in between

       var result = new Array();


       result.push( [min, null] );

       result.push( [min + ((max - min) / 2), null] );

       result.push( [max, null] );


       // Given a chart with a min and max of 0 and 100, the resulting array looks like:

       //  [

       //    [0, null],

       //    [50, null],

       //    [100, null]

       //  ]

       return result;