EJSC.Axis.addBin

See Also

 

Definition

 

void addBin( String label, boolean redraw )

 

Description

 

Adds a new static label to the axis and sets the appropriate flags if necessary to force the chart to draw using static labels (as opposed to a dynamic range based on series data).

 

This method is useful if there is a need to include bins which may not be part of any series added (i.e. chart labels should be "Apples", "Oranges", "Pears" but the series data only contains data pertaining to Apples and Pears).

 

If redraw is false, drawing will not occur immediately but will not be entirely prevented.  Certain actions such as adding an additional series with redraw = true, or chart dimensions changing may still trigger the chart to draw.  The default, if redraw is omitted is true.

 

Note:

 

Manually added bins may only be removed if there are no series currently utilizing them.

 

Example

 

>> Add bins in a specific order to ensure they appear the same each time the chart is loaded, regardless of the order in which they appear in the data.

 

var myChart = new EJSC.Chart("chart");

myChart.axis_bottom.addBin("Salesman 1");

myChart.axis_bottom.addBin("Salesman 2");

myChart.axis_bottom.addBin("Salesman 3");

 

var mySeries = myChart.addSeries(

   new EJSC.BarSeries(...)

);