org.moxieapps.gwt.highcharts.client
Class Axis<T extends Axis>

java.lang.Object
  extended by org.moxieapps.gwt.highcharts.client.Configurable<T>
      extended by org.moxieapps.gwt.highcharts.client.Axis<T>
Direct Known Subclasses:
XAxis, YAxis, ZAxis

public abstract class Axis<T extends Axis>
extends Configurable<T>

The base class for both the X and Y axis types, which allows for general options to be set via the inherited Configurable.setOption(String, Object) method. But also exposes type specific methods that the caller is encouraged to use instead, such as setAllowDecimals(boolean), setAlternateGridColor(String), etc.

Note that you won't normally work with this class directly, but instead one of it's sub-types such as XAxis or YAxis.

Since:
1.0.0
Author:
squinn@moxiegroup.com (Shawn Quinn)

Nested Class Summary
static class Axis.TickPosition
          An enumeration of supported tick positions, which can be passed to methods such as setMinorTickPosition(Axis.TickPosition) and setTickPosition(Axis.TickPosition)
static class Axis.Type
          An enumeration of supported axis types, which can be passed to methods such as setType(Axis.Type).
static class Axis.WeekDay
          An enumeration of supported week days, which can be passed to methods such as setStartOfWeek(Axis.WeekDay).
 
Method Summary
 T addPlotBands(PlotBand... plotBands)
          Allows plot bands to be added to an axis after the chart is rendered.
 T addPlotLines(PlotLine... plotLines)
          Allows plot lines to be added to an axis after the chart is rendered.
 PlotBand createPlotBand()
          Create a new plot band that can be configured, and then added to this axis instance via the setPlotBands(PlotBand...) method.
 PlotLine createPlotLine()
          Create a new plot line that can be configured, and then added to this axis instance via the setPlotLines(PlotLine...) method.
 AxisSetExtremesEventHandler getAxisSetExtremesEventHandler()
          Returns the custom event handler that has been set on the axis, or null if no event handler has been set.
 Extremes getExtremes()
          Return a non-null object that represents the current extremes for the axis.
 com.google.gwt.core.client.JavaScriptObject getNativeAxis()
          Returns a pointer to the native Highchart's Axis instance that this GWT Axis instance is associated with.
 T removePlotBand(PlotBand plotBand)
          Remove the given plot band from the chart after it has been rendered, automatically redrawing the chart after the plot band has been removed.
 T removePlotLine(PlotLine plotLine)
          Remove the given plot line from the chart after it has been rendered, automatically redrawing the chart after the plot line has been removed.
 T setAllowDecimals(boolean allowDecimals)
          Convenience method for setting the 'allowDecimals' option for the axis.
 T setAlternateGridColor(String alternateGridColor)
          Convenience method for setting the 'alternateGridColor' option for the axis.
 T setAxisSetExtremesEventHandler(AxisSetExtremesEventHandler axisSetExtremesEventHandler)
          Set a callback handler that will be invoked whenever the minimum and maximum is set for the axis, either by calling the setExtremes(Number, Number) method or by selecting an area in the chart.
 T setAxisTitle(AxisTitle title)
          Convenience method for setting the 'title/text' axis option, before or after the chart is rendered.
 T setAxisTitle(AxisTitle title, boolean redraw)
          Convenience method for setting the 'title/text' axis option, before or after the chart is rendered (explicitly controlling whether or not the new title will be immediately drawn in the case of being called after the chart is rendered).
 T setAxisTitleText(String title)
          Convenience method for setting the 'title/text' axis option, before or after the chart is rendered.
 T setAxisTitleText(String title, boolean redraw)
          Convenience method for setting the 'title/text' axis option, before or after the chart is rendered (explicitly controlling whether or not the new title will be immediately drawn in the case of being called after the chart is rendered).
 T setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
          Convenience method for setting the 'dateTimeLabelFormats' options of the axis.
 T setEndOnTick(boolean endOnTick)
          Convenience method for setting the 'endOnTick' option for the axis.
 T setExtremes(Number min, Number max)
          Set the minimum and maximum of the axes after render time using the default animation options.
 T setExtremes(Number min, Number max, boolean redraw, Animation animation)
          Set the minimum and maximum of the axes after render time, controlling the redraw and animation options.
 T setExtremes(Number min, Number max, boolean redraw, boolean animation)
          Set the minimum and maximum of the axes after render time, controlling the redraw and animation status.
 T setGridLineColor(String gridLineColor)
          Convenience method for setting the 'gridLineColor' option for the axis.
 T setGridLineDashStyle(PlotLine.DashStyle gridLineDashStyle)
          Convenience method for setting the 'gridLineDashStyle' axis option.
 T setGridLineWidth(Number gridLineWidth)
          Convenience method for setting the 'gridLineWidth' option for the axis.
 T setLineColor(String lineColor)
          Convenience method for setting the 'lineColor' option for the axis.
 T setLineWidth(Number lineWidth)
          Convenience method for setting the 'lineWidth' option for the axis.
 T setLinkedTo(Number linkedTo)
          Convenience method for setting the 'linkedTo' option for the axis.
 T setMax(Number max)
          Convenience method for setting the 'max' option for the axis.
 T setMaxPadding(Number maxPadding)
          Convenience method for setting the 'maxPadding' option for the axis.
 T setMaxZoom(Number maxZoom)
          Convenience method for setting the 'maxZoom' option for the axis.
 T setMin(Number min)
          Convenience method for setting the 'min' option for the axis.
 T setMinorGridLineColor(String minorGridLineColor)
          Convenience method for setting the 'minorGridLineColor' option for the axis.
 T setMinorGridLineDashStyle(PlotLine.DashStyle minorGridLineDashStyle)
          Convenience method for setting the 'minorGridLineDashStyle' axis option.
 T setMinorGridLineWidth(Number minorGridLineWidth)
          Convenience method for setting the 'minorGridLineWidth' option for the axis.
 T setMinorTickColor(String minorTickColor)
          Convenience method for setting the 'minorTickColor' option for the axis.
 T setMinorTickInterval(Number minorTickInterval)
          Convenience method for setting the 'minorTickInterval' option for the axis.
 T setMinorTickIntervalAuto()
          Convenience method for setting the 'minorTickInterval' option for the axis to auto.
 T setMinorTickLength(Number minorTickLength)
          Convenience method for setting the 'minorTickLength' option for the axis.
 T setMinorTickPosition(Axis.TickPosition minorTickPosition)
          Convenience method for setting the 'minorTickPosition' option for the axis.
 T setMinorTickWidth(Number minorTickWidth)
          Convenience method for setting the 'minorTickWidth' option for the axis.
 T setMinPadding(Number minPadding)
          Convenience method for setting the 'minPadding' option for the axis.
 T setOffset(Number offset)
          Convenience method for setting the 'offset' option for the axis.
 T setOpposite(boolean opposite)
          Convenience method for setting the 'opposite' option for the axis.
 T setPlotBands(PlotBand... plotBands)
          Sets the 'plotBands' array for the axis.
 T setPlotLines(PlotLine... plotLines)
          Sets the 'plotLines' array for the axis.
 T setReversed(boolean reversed)
          Convenience method for setting the 'reversed' option for the axis.
 T setShowEmpty(boolean showEmpty)
          Convenience method for setting the 'showEmpty' option for the axis.
 T setShowFirstLabel(boolean showFirstLabel)
          Convenience method for setting the 'showFirstLabel' option for the axis.
 T setShowLastLabel(boolean showLastLabel)
          Convenience method for setting the 'showLastLabel' option for the axis.
 T setStartOfWeek(Axis.WeekDay startOfWeek)
          Convenience method for setting the 'startOfWeek' option for the axis.
 T setStartOnTick(boolean startOnTick)
          Convenience method for setting the 'startOnTick' option for the axis.
 T setTickColor(String tickColor)
          Convenience method for setting the 'tickColor' option for the axis.
 T setTickInterval(Number tickInterval)
          Convenience method for setting the 'tickInterval' option for the axis.
 T setTickLength(Number tickLength)
          Convenience method for setting the 'tickLength' option for the axis.
 T setTickPixelInterval(Number tickPixelInterval)
          Convenience method for setting the 'tickPixelInterval' option for the axis.
 T setTickPosition(Axis.TickPosition tickPosition)
          Convenience method for setting the 'tickPosition' option for the axis.
 T setTickWidth(Number tickWidth)
          Convenience method for setting the 'tickWidth' option for the axis.
 T setType(Axis.Type type)
          Convenience method for setting the 'type' axis option.
 T update(Axis axisOptions)
          Update an axis object with a new set of options.
 T update(Axis axisOptions, boolean redraw)
          Update an axis object with a new set of options.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable
getOptions, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setAxisSetExtremesEventHandler

public T setAxisSetExtremesEventHandler(AxisSetExtremesEventHandler axisSetExtremesEventHandler)
Set a callback handler that will be invoked whenever the minimum and maximum is set for the axis, either by calling the setExtremes(Number, Number) method or by selecting an area in the chart. Additional information about the new extremes value (such as the new minimum and maximum) can be found via the AxisSetExtremesEvent instance that is passed to the handler's AxisSetExtremesEventHandler.onSetExtremes(org.moxieapps.gwt.highcharts.client.events.AxisSetExtremesEvent) method.

Parameters:
axisSetExtremesEventHandler - The handler that should be invoked whenever a set extremes event occurs.
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.3.0

getAxisSetExtremesEventHandler

public AxisSetExtremesEventHandler getAxisSetExtremesEventHandler()
Returns the custom event handler that has been set on the axis, or null if no event handler has been set.

Returns:
The custom event handler that has been applied, or null if it has not been set.
Since:
1.3.0

createPlotLine

public PlotLine createPlotLine()
Create a new plot line that can be configured, and then added to this axis instance via the setPlotLines(PlotLine...) method.

Returns:
The plot line that was created (which will need to be added to the axis after it is configured via setPlotLines(PlotLine...).

createPlotBand

public PlotBand createPlotBand()
Create a new plot band that can be configured, and then added to this axis instance via the setPlotBands(PlotBand...) method.

Returns:
The plot babd that was created (which will need to be added to the axis after it is configured via setPlotBands(PlotBand...).

setAllowDecimals

public T setAllowDecimals(boolean allowDecimals)
Convenience method for setting the 'allowDecimals' option for the axis. Equivalent to:

     axis.setOption("allowDecimals", false);
 
Whether to allow decimals in this axis' ticks. When counting integers, like persons or hits on a web page, decimals must be avoided in the axis tick labels. Defaults to true.

Parameters:
allowDecimals - Whether to allow decimals in this axis' ticks.
Returns:
A reference to this Axis instance for convenient method chaining.

setAlternateGridColor

public T setAlternateGridColor(String alternateGridColor)
Convenience method for setting the 'alternateGridColor' option for the axis. Equivalent to:

     axis.setOption("alternateGridColor", "#CC0000");
 
When using an alternate grid color, a band is painted across the plot area between every other grid line. Defaults to null.

Parameters:
alternateGridColor - The color to use as the alternate grid color.
Returns:
A reference to this Axis instance for convenient method chaining.

setDateTimeLabelFormats

public T setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
Convenience method for setting the 'dateTimeLabelFormats' options of the axis. Equivalent to code like:

     axis.setOption("/dateTimeLabelFormats/second", "%H:%M:%S");
     axis.setOption("/dateTimeLabelFormats/minute", "%H:%M");
 
For a datetime axis, the scale will automatically adjust to the appropriate unit. This configuration option sets the default string format representations used for each unit. For an overview of the replacement codes available see the javadoc on the DateTimeLabelFormats class. Defaults to: Example usage:
   axis.setDateTimeLabelFormats(
     new DateTimeLabelFormats()
       .setHour("%I %p")
       .setMinute("%I:%M %p")
   );
 

Parameters:
dateTimeLabelFormats - The formats to use for time series information on this axis.
Returns:
A reference to this Axis instance for convenient method chaining.

setEndOnTick

public T setEndOnTick(boolean endOnTick)
Convenience method for setting the 'endOnTick' option for the axis. Equivalent to:

     axis.setOption("endOnTick", true);
 
Whether to force the axis to end on a tick. Use this option with the maxPadding option to control the axis end. Defaults to false.

Parameters:
endOnTick - Whether to force the axis to end on a tick.
Returns:
A reference to this Axis instance for convenient method chaining.

setExtremes

public T setExtremes(Number min,
                     Number max)
Set the minimum and maximum of the axes after render time using the default animation options. If the startOnTick and endOnTick options are true, the minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to false before calling this method.

Also note that this method will use the default chart animation options when changing the extremes. To control the animation more specifically use the setExtremes(Number, Number, boolean, boolean) or setExtremes(Number, Number, boolean, Animation) method instead.

Parameters:
min - The new minimum value.
max - The new maximum value.
Returns:
A reference to this Axis instance for convenient method chaining.

setExtremes

public T setExtremes(Number min,
                     Number max,
                     boolean redraw,
                     boolean animation)
Set the minimum and maximum of the axes after render time, controlling the redraw and animation status. If the startOnTick and endOnTick options are true, the minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to false before calling this method.

The gain more control over the animation used when the extremes are changed, use the setExtremes(Number, Number, boolean, Animation) method instead.

Parameters:
min - The new minimum value.
max - The new maximum value.
redraw - 'true' to force the chart to redraw immediately, or 'false' to wait until the BaseChart.redraw() method is invoked.
animation - When 'true', the chart updating will be animated with default animation options. Note, use the setExtremes(Number, Number, boolean, Animation) method for more control over the animation options.
Returns:
A reference to this Axis instance for convenient method chaining.

setExtremes

public T setExtremes(Number min,
                     Number max,
                     boolean redraw,
                     Animation animation)
Set the minimum and maximum of the axes after render time, controlling the redraw and animation options. If the startOnTick and endOnTick options are true, the minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to false before calling this method.

This method is intended to be used for callers that need tight control over the animation that will run when the chart extremes are applied. If you don't need tight control over the animation you can use the setExtremes(Number, Number) or setExtremes(Number, Number, boolean, boolean) method instead.

Parameters:
min - The new minimum value.
max - The new maximum value.
redraw - 'true' to force the chart to redraw immediately, or 'false' to wait until the BaseChart.redraw() method is invoked.
animation - Custom animation to use when the chart extremes are being updated.
Returns:
A reference to this Axis instance for convenient method chaining.

getExtremes

public Extremes getExtremes()
Return a non-null object that represents the current extremes for the axis. Note that if this method is invoked before the chart has been rendered, only the configured min/max values will be known.

Returns:
The current extremes for the axis.

getNativeAxis

public com.google.gwt.core.client.JavaScriptObject getNativeAxis()
Returns a pointer to the native Highchart's Axis instance that this GWT Axis instance is associated with. Note that this method will only return a non-null value if it is called after the chart has been rendered. For advanced use-cases only.

Returns:
The native Highcharts axis instance that this Axis is associated with, or null if the chart has not yet been rendered.
Since:
1.4.0

setGridLineColor

public T setGridLineColor(String gridLineColor)
Convenience method for setting the 'gridLineColor' option for the axis. Equivalent to:

     axis.setOption("gridLineColor", "#CCCCCC");
 
Color of the grid lines extending the ticks across the plot area. Defaults to "#C0C0C0".

Parameters:
gridLineColor - Color of the grid lines extending the ticks across the plot area.
Returns:
A reference to this Axis instance for convenient method chaining.

setGridLineDashStyle

public T setGridLineDashStyle(PlotLine.DashStyle gridLineDashStyle)
Convenience method for setting the 'gridLineDashStyle' axis option. Equivalent to:

     plotOptions.setOption("gridLineDashStyle", PlotOptions.DashStyle.LONG_DASH);
 
The dash or dot style of the grid lines. Defaults to DashStyle.DOT. See this demonstration for a visible reference of the available dash styles.

Parameters:
gridLineDashStyle - Sets the dash or dot style of the grid lines, or null to return to the default.
Returns:
A reference to this Axis instance for convenient method chaining.

setGridLineWidth

public T setGridLineWidth(Number gridLineWidth)
Convenience method for setting the 'gridLineWidth' option for the axis. Equivalent to:

     axis.setOption("gridLineWidth", 2);
 
The width of the grid lines extending the ticks across the plot area. Defaults to 0.

Parameters:
gridLineWidth - The new width of the grid lines extending the ticks across the plot area.
Returns:
A reference to this Axis instance for convenient method chaining.

setLineColor

public T setLineColor(String lineColor)
Convenience method for setting the 'lineColor' option for the axis. Equivalent to:

     axis.setOption("lineColor", "#00CC00");
 
The color of the line marking the axis itself. Defaults to "#C0D0E0".

Parameters:
lineColor - The new color of the line marking the axis itself.
Returns:
A reference to this Axis instance for convenient method chaining.

setLineWidth

public T setLineWidth(Number lineWidth)
Convenience method for setting the 'lineWidth' option for the axis. Equivalent to:

     axis.setOption("lineWidth", 2);
 
The width of the line marking the axis itself. Defaults to 1.

Parameters:
lineWidth - The new width of the line marking the axis itself.
Returns:
A reference to this Axis instance for convenient method chaining.

setLinkedTo

public T setLinkedTo(Number linkedTo)
Convenience method for setting the 'linkedTo' option for the axis. Equivalent to:

     axis.setOption("linkedTo", 2);
 
Index of another axis that this axis is linked to. When an axis is linked to a master axis, it will take the same extremes as the master, but as assigned by setMin(Number) or setMax(Number) or by setExtremes(Number, Number). It can be used to show additional info, or to ease reading the chart by duplicating the scales. Defaults to null.

Parameters:
linkedTo - The index of another axis that this axis is linked to.
Returns:
A reference to this Axis instance for convenient method chaining.

setMax

public T setMax(Number max)
Convenience method for setting the 'max' option for the axis. Equivalent to:

     axis.setOption("max", 100);
 
The maximum value of the axis. If null, the max value is automatically calculated. If the setEndOnTick(boolean) option is true, the max value might be rounded up. The actual maximum value is also influenced by BaseChart.setAlignTicks(boolean) setting. Defaults to null.

Note that this method will only affect the maximum value of the chart before it is rendered. To change the min/max value of the chart after render time use the setExtremes(Number, Number) method instead.

Parameters:
max - The maximum value of the axis, or null to automatically calculate the maximum.
Returns:
A reference to this Axis instance for convenient method chaining.

setMaxPadding

public T setMaxPadding(Number maxPadding)
Convenience method for setting the 'maxPadding' option for the axis. Equivalent to:

     axis.setOption("maxPadding", 0.05);
 
Padding of the max value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the highest data value to appear on the edge of the plot area. When the axis' max option is set or a max extreme is set using setExtremes(Number, Number), the maxPadding will be ignored. Defaults to 0.01.

Parameters:
maxPadding - The new padding of the max value relative to the length of the axis.
Returns:
A reference to this Axis instance for convenient method chaining.

setMaxZoom

public T setMaxZoom(Number maxZoom)
Convenience method for setting the 'maxZoom' option for the axis. Equivalent to:

     axis.setOption("maxZoom", 5);
 
The maximum amount of zoom on this axis. The entire axis will not be allowed to span over a smaller interval than this. For example, for a datetime axis the main unit is milliseconds. If maxZoom is set to 3600000, you can't zoom in more than to one hour.

Parameters:
maxZoom - The new maximum amount of zoom on this axis.
Returns:
A reference to this Axis instance for convenient method chaining.

setMin

public T setMin(Number min)
Convenience method for setting the 'min' option for the axis. Equivalent to:

     axis.setOption("min", 10);
 
The minimum value of the axis. If null, the min value is automatically calculated. If the setStartOnTick(boolean) option is true, the min value might be rounded down. Defaults to null.

Note that this method will only affect the minimum value of the chart before it is rendered. To change the min/max value of the chart after render time use the setExtremes(Number, Number) method instead.

Parameters:
min - The minimum value of the axis, or null to automatically calculate the minimum.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorGridLineColor

public T setMinorGridLineColor(String minorGridLineColor)
Convenience method for setting the 'minorGridLineColor' option for the axis. Equivalent to:

     axis.setOption("minorGridLineColor", "#00CC00");
 
Color of the minor, secondary grid lines. Defaults to #E0E0E0.

Parameters:
minorGridLineColor - The new color of the minor, secondary grid lines.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorGridLineDashStyle

public T setMinorGridLineDashStyle(PlotLine.DashStyle minorGridLineDashStyle)
Convenience method for setting the 'minorGridLineDashStyle' axis option. Equivalent to:

     plotOptions.setOption("minorGridLineDashStyle", PlotOptions.DashStyle.LONG_DASH);
 
The dash or dot style of the grid lines. Defaults to DashStyle.SOLID. See this demonstration for a visible reference of the available dash styles.

Parameters:
minorGridLineDashStyle - Sets the dash or dot style of the minor grid lines, or null to return to the default.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorGridLineWidth

public T setMinorGridLineWidth(Number minorGridLineWidth)
Convenience method for setting the 'minorGridLineWidth' option for the axis. Equivalent to:

     axis.setOption("minorGridLineWidth", 2);
 
The width of the minor, secondary grid lines. Defaults to 1.

Parameters:
minorGridLineWidth - The new width of the minor, secondary grid lines.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickColor

public T setMinorTickColor(String minorTickColor)
Convenience method for setting the 'minorTickColor' option for the axis. Equivalent to:

     axis.setOption("minorTickColor", "#00CC00");
 
Color for the minor tick marks. Defaults to #A0A0A0.

Parameters:
minorTickColor - The new color for the minor tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickInterval

public T setMinorTickInterval(Number minorTickInterval)
Convenience method for setting the 'minorTickInterval' option for the axis. Equivalent to:

     axis.setOption("minorTickInterval", 2);
 
Tick interval in scale units for the minor ticks. If null, minor ticks are not shown. Defaults to null. Note that if you instead call the setMinorTickIntervalAuto() method the minor tick interval is calculated as a fifth of the tickInterval.

Parameters:
minorTickInterval - The new tick interval in scale units for the minor ticks.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickIntervalAuto

public T setMinorTickIntervalAuto()
Convenience method for setting the 'minorTickInterval' option for the axis to auto. Equivalent to:

     axis.setOption("minorTickInterval", "auto");
 
Note, if you instead want to set the tick interval to a specific numeric value (or disable the ticks completely), you'll want to use the setMinorTickInterval(Number) method.

Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickLength

public T setMinorTickLength(Number minorTickLength)
Convenience method for setting the 'minorTickLength' option for the axis. Equivalent to:

     axis.setOption("minorTickLength", 4);
 
The pixel length of the minor tick marks. Defaults to 2.

Parameters:
minorTickLength - The new pixel length of the minor tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickPosition

public T setMinorTickPosition(Axis.TickPosition minorTickPosition)
Convenience method for setting the 'minorTickPosition' option for the axis. Equivalent to:

     axis.setOption("minorTickPosition", TickPosition.INSIDE);
 
The position of the minor tick marks relative to the axis line. Defaults to Axis.TickPosition.OUTSIDE.

Parameters:
minorTickPosition - The new position of the minor tick marks relative to the axis line, or null to return to the default.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinorTickWidth

public T setMinorTickWidth(Number minorTickWidth)
Convenience method for setting the 'minorTickWidth' option for the axis. Equivalent to:

     axis.setOption("minorTickWidth", 4);
 
The pixel width of the minor tick mark. Defaults to 0.

Parameters:
minorTickWidth - The new pixel width of the minor tick mark.
Returns:
A reference to this Axis instance for convenient method chaining.

setMinPadding

public T setMinPadding(Number minPadding)
Convenience method for setting the 'minPadding' option for the axis. Equivalent to:

     axis.setOption("minPadding", 0.05);
 
Padding of the min value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the highest data value to appear on the edge of the plot area. When the axis' min option is set or a max extreme is set using setExtremes(Number, Number), the minPadding will be ignored. Defaults to 0.01.

Parameters:
minPadding - The new padding of the min value relative to the length of the axis.
Returns:
A reference to this Axis instance for convenient method chaining.

setOffset

public T setOffset(Number offset)
Convenience method for setting the 'offset' option for the axis. Equivalent to:

     axis.setOption("offset", 60);
 
The distance in pixels from the plot area to the axis line. A positive offset moves the axis with it's line, labels and ticks away from the plot area. This is typically used when two or more axes are displayed on the same side of the plot. Defaults to 0.

Parameters:
offset - The new distance in pixels from the plot area to the axis line.
Returns:
A reference to this Axis instance for convenient method chaining.

setOpposite

public T setOpposite(boolean opposite)
Convenience method for setting the 'opposite' option for the axis. Equivalent to:

     axis.setOption("opposite", true);
 
Whether to display the axis on the opposite side of the normal. The normal is on the left side for vertical axes and bottom for horizontal, so the opposite sides will be right and top respectively. This is typically used with dual or multiple axes. Defaults to false.

Parameters:
opposite - 'true' to display the axis on the opposite side of the normal, 'false' to show the axis on the normal side.
Returns:
A reference to this Axis instance for convenient method chaining.

setPlotLines

public T setPlotLines(PlotLine... plotLines)
Sets the 'plotLines' array for the axis. A plot line is a line stretching across the plot area, marking a specific value on one of the axes. Example usage:
   XAxis xAxis = chart.getXAxis()
   xAxis.getXAxis()
     .setPlotLines(
       xAxis.createPlotLine()
          .setColor("#CC0000")
          .setValue(40),
       xAxis.createPlotLine()
          .setColor("#009900")
          .setValue(60)
     )
   );
 

Parameters:
plotLines - One or more PlotLine instances that represent the options of each line to render
Returns:
A reference to this Axis instance for convenient method chaining.

setPlotBands

public T setPlotBands(PlotBand... plotBands)
Sets the 'plotBands' array for the axis. A plot band is a colored band stretching across the plot area marking an interval on the axis. Example usage:
   XAxis xAxis = chart.getXAxis()
     .setPlotBands(
       xAxis.createPlotBand()
          .setColor("#CC0000")
          .setFrom(40)
          .setTo(80),
       xAxis.createPlotBand()
          .setColor("#009900")
          .setFrom(90)
          .setTo(120),
     )
   );
 

Parameters:
plotBands - One or more PlotBand instances that represent the options of each band to render
Returns:
A reference to this Axis instance for convenient method chaining.

setReversed

public T setReversed(boolean reversed)
Convenience method for setting the 'reversed' option for the axis. Equivalent to:

     axis.setOption("reversed", true);
 
Whether to reverse the axis so that the highest number is closest to origin. If the chart is inverted, the x axis is reversed by default. Defaults to false.

Parameters:
reversed - 'true' to reverse the axis so that the highest number is closest to origin, 'false' to show the axis in its default orientation.
Returns:
A reference to this Axis instance for convenient method chaining.

setShowEmpty

public T setShowEmpty(boolean showEmpty)
Convenience method for setting the 'showEmpty' option for the axis. Equivalent to:

     axis.setOption("showEmpty", false);
 
Whether to show the axis line and title when the axis has no data. Defaults to true.

Parameters:
showEmpty - 'true' to show the axis line when the axis has no data (default,) false to hide the axis line when the series has no data
Returns:
A reference to this Axis instance for convenient method chaining.

setShowFirstLabel

public T setShowFirstLabel(boolean showFirstLabel)
Convenience method for setting the 'showFirstLabel' option for the axis. Equivalent to:

     axis.setOption("showFirstLabel", false);
 
Whether to show the first tick label. Defaults to true.

Parameters:
showFirstLabel - 'true' to show the first tick label (the default), 'false' to hide it.
Returns:
A reference to this Axis instance for convenient method chaining.

setShowLastLabel

public T setShowLastLabel(boolean showLastLabel)
Convenience method for setting the 'showLastLabel' option for the axis. Equivalent to:

     axis.setOption("showLastLabel", true);
 
Whether to show the last tick label. Defaults to false.

Parameters:
showLastLabel - 'true' to show the first tick label, 'false' to hide it (the default).
Returns:
A reference to this Axis instance for convenient method chaining.

setStartOfWeek

public T setStartOfWeek(Axis.WeekDay startOfWeek)
Convenience method for setting the 'startOfWeek' option for the axis. Equivalent to:

     axis.setOption("startOfWeek", WeekDay.SUNDAY);
 
For datetime axes, this decides where to put the tick between weeks. Defaults to 1 Axis.WeekDay.MONDAY.

Parameters:
startOfWeek - The day of the week where tick marks should be placed between weeks.
Returns:
A reference to this Axis instance for convenient method chaining.

setStartOnTick

public T setStartOnTick(boolean startOnTick)
Convenience method for setting the 'startOnTick' option for the axis. Equivalent to:

     axis.setOption("startOnTick", true);
 
Whether to force the axis to start on a tick. Use this option with the setMaxPadding(Number) option to control the axis start. Defaults to false.

Parameters:
startOnTick - 'true' to force the axis to start on a tick, 'false' for the default behavior.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickColor

public T setTickColor(String tickColor)
Convenience method for setting the 'tickColor' option for the axis. Equivalent to:

     axis.setOption("tickColor", "#00CC00");
 
Color for the main tick marks. Defaults to #C0D0E0.

Parameters:
tickColor - The new color for the main tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickInterval

public T setTickInterval(Number tickInterval)
Convenience method for setting the 'tickInterval' option for the axis. Equivalent to:

     axis.setOption("tickInterval", 5);
 
The interval of the tick marks in axis units. When null, the tick interval is computed to approximately follow the tickPixelInterval on linear and datetime axes. On categorized axes, a null tickInterval will default to 1, one category. Note that datetime axes are based on milliseconds, so for example an interval of one day is expressed as 24 * 3600 * 1000. Defaults to null.

Parameters:
tickInterval - The interval of the tick marks in axis units, or null to follow the default interval logic.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickLength

public T setTickLength(Number tickLength)
Convenience method for setting the 'tickLength' option for the axis. Equivalent to:

     axis.setOption("tickLength", 20);
 
The pixel length of the main tick marks. Defaults to 5.

Parameters:
tickLength - The new pixel length of the main tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickPixelInterval

public T setTickPixelInterval(Number tickPixelInterval)
Convenience method for setting the 'tickPixelInterval' option for the axis. Equivalent to:

     axis.setOption("tickPixelInterval", 50);
 
If tickInterval is null (the default) this option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to 72 for the Y axis and 100 for the X axis.

Parameters:
tickPixelInterval - The new approximate pixel interval of the tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickPosition

public T setTickPosition(Axis.TickPosition tickPosition)
Convenience method for setting the 'tickPosition' option for the axis. Equivalent to:

     axis.setOption("tickPosition", TickPosition.INSIDE);
 
The position of the major tick marks relative to the axis line. Defaults to Axis.TickPosition.OUTSIDE.

Parameters:
tickPosition - The new position of the major tick marks relative to the axis line.
Returns:
A reference to this Axis instance for convenient method chaining.

setTickWidth

public T setTickWidth(Number tickWidth)
Convenience method for setting the 'tickWidth' option for the axis. Equivalent to:

     axis.setOption("tickWidth", 10);
 
The pixel width of the major tick marks. Defaults to 1.

Parameters:
tickWidth - The new pixel width of the major tick marks.
Returns:
A reference to this Axis instance for convenient method chaining.

setAxisTitleText

public T setAxisTitleText(String title)
Convenience method for setting the 'title/text' axis option, before or after the chart is rendered. Before the chart is rendered this is equivalent to:

     axis.setOption("/title/text", "A Fine Axis Indeed");
 
After the chart is rendered this is equivalent to a direct JS call like

     Axis.setTitle({text: "A Fine Axis Indeed"});
 
The actual text of the axis title. It can contain basic HTML text markup like <b>, <i> and spans with style. Defaults to null for the x-axis and "Y-values" for the y-axis.

Note that for more control over the title, utilize the setAxisTitle(AxisTitle) method instead.

Also note that to hide an axis title completely, simply set the text to null.

Parameters:
title - Sets the title of axis, or null to hide the title.
Returns:
A reference to this Axis instance for convenient method chaining.

setAxisTitleText

public T setAxisTitleText(String title,
                          boolean redraw)
Convenience method for setting the 'title/text' axis option, before or after the chart is rendered (explicitly controlling whether or not the new title will be immediately drawn in the case of being called after the chart is rendered). Before the chart is rendered this is equivalent to:

     axis.setOption("/title/text", "A Fine Axis Indeed");
 
After the chart is rendered this is equivalent to a JS call like:

     Axis.setTitle({text: "A Fine Axis Indeed"}, true);
 
The actual text of the axis title. It can contain basic HTML text markup like <b>, <i> and spans with style. Defaults to null for the x-axis and "Y-values" for the y-axis.

Note that for more control over the title, utilize the setAxisTitle(AxisTitle) method instead.

Also note that to hide an axis title completely, simply set the text to null.

Parameters:
title - Sets the title of axis, or null to hide the title.
redraw - Whether to redraw the chart now or hold until the next BaseChart.redraw()
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.2.0

setAxisTitle

public T setAxisTitle(AxisTitle title)
Convenience method for setting the 'title/text' axis option, before or after the chart is rendered. Before the chart is rendered this is equivalent to:

     axis.setOption("/title/text", "A Fine Axis Indeed");
     axis.setOption("/title/align", AxisTitle.Align.HIGH);
 
After the chart is rendered this is equivalent to a JS call like:

     Axis.setTitle({text: "A Fine Axis Indeed", align: "high"});
 

Note that if you call this method it will overwrite any existing settings that have already been applied to the title (e.g. if you had previously called the setAxisTitleText(String) method that change will get overwritten by this call.)

Note that if you only want to change the text of the axis, you can simply use the setAxisTitleText(String) method instead.

Parameters:
title - Sets the axis title options, or null to hide the title.
Returns:
A reference to this Axis instance for convenient method chaining.

setAxisTitle

public T setAxisTitle(AxisTitle title,
                      boolean redraw)
Convenience method for setting the 'title/text' axis option, before or after the chart is rendered (explicitly controlling whether or not the new title will be immediately drawn in the case of being called after the chart is rendered). Before the chart is rendered this is equivalent to:

     axis.setOption("/title/text", "A Fine Axis Indeed");
     axis.setOption("/title/align", AxisTitle.Align.HIGH);
 
After the chart is rendered this is equivalent to a JS call like:

     Axis.setTitle({text: "A Fine Axis Indeed", align: "high"});
 

Note that if you call this method it will overwrite any existing settings that have already been applied to the title (e.g. if you had previously called the setAxisTitleText(String) method that change will get overwritten by this call.)

Note that if you only want to change the text of the axis, you can simply use the setAxisTitleText(String) method instead.

Parameters:
title - Sets the axis title options, or null to hide the title.
redraw - Whether to redraw the chart now or hold until the next BaseChart.redraw()
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.2.0

setType

public T setType(Axis.Type type)
Convenience method for setting the 'type' axis option. Equivalent to:

     axis.setOption("type", Axis.Type.DATE_TIME);
 
The type of axis. Can be one of "linear" or "datetime". In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days. Defaults to Axis.Type.LINEAR.

Parameters:
type - Sets the type of axis.
Returns:
A reference to this Axis instance for convenient method chaining.

addPlotLines

public T addPlotLines(PlotLine... plotLines)
Allows plot lines to be added to an axis after the chart is rendered. If you want to add plot lines to chart before it is rendered, please utilize the setPlotLines(PlotLine...) method instead.

Parameters:
plotLines - One or more PlotLine instances that represent the options of each line to render
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.1.3

addPlotBands

public T addPlotBands(PlotBand... plotBands)
Allows plot bands to be added to an axis after the chart is rendered. If you want to add plot bands to chart before it is rendered, please utilize the setPlotBands(PlotBand...) method instead.

Parameters:
plotBands - One or more PlotBand instances that represent the options of each band to render
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.1.3

removePlotLine

public T removePlotLine(PlotLine plotLine)
Remove the given plot line from the chart after it has been rendered, automatically redrawing the chart after the plot line has been removed.

Parameters:
plotLine - The PlotLine instance to remove from the chart.
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.1.3

removePlotBand

public T removePlotBand(PlotBand plotBand)
Remove the given plot band from the chart after it has been rendered, automatically redrawing the chart after the plot band has been removed.

Parameters:
plotBand - The PlotBand instance to remove from the chart.
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.1.3

update

public T update(Axis axisOptions)
Update an axis object with a new set of options. The options are merged with the existing options, so only new or altered options need to be specified.

Parameters:
axisOptions - The new options that will be merged in with existing options on the axis.
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.6.1

update

public T update(Axis axisOptions,
                boolean redraw)
Update an axis object with a new set of options. The options are merged with the existing options, so only new or altered options need to be specified.

Parameters:
axisOptions - The new options that will be merged in with existing options on the axis.
redraw - Defaults to true. Whether to redraw the chart after the new options are set.
Returns:
A reference to this Axis instance for convenient method chaining.
Since:
1.6.1


Copyright © 2015. All Rights Reserved.