Class Axis
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Axis
-
- All Implemented Interfaces:
Serializable,OptionDataListener,org.zkoss.json.JSONAware
public class Axis extends Optionable
A chart can have from 0 axes (pie chart) to multiples. In a normal, single series cartesian chart, there is one X axis and one Y axis. The X axis or axes are referenced byCharts.getXAxis(int). If there is only one axis, it can be referenced throughCharts.getXAxis(), and multiple axes have increasing indices. The same pattern goes for Y axes.All the options in this class support
DynamicalAttribute.- Author:
- jumperchen, RaymondChao
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Axis()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPlotBand(PlotBand plotBand)Adds a plot band after render time.voidaddPlotLine(PlotLine plotLine)Adds a plot line after render time.AxisAccessibilitygetAccessibility()Returns an accessibility options for an axis, if null, it will create new one.ColorgetAlternateGridColor()Returns when using an alternate grid color, a band is painted across the plot area between every other grid line.NumbergetAngle()Returns the angle of the Y axis in degrees.List<String>getCategories()Returns the categories in a list.NumbergetCeiling()Returns the highest allowed value for automatically computed axis extremes.StringgetClassName()Returns a class name that opens for styling the axis by CSS, especially in Highcharts styled mode.NumbergetCrossing()Returns the value on a perpendicular axis where this axis should cross.DateTimeLabelFormatsgetDateTimeLabelFormats()Returns for a datetime axis, the scale will automatically adjust to the appropriate unit.NumbergetFloor()Returns the lowest allowed value for automatically computed axis extremes.ColorgetGridLineColor()Returns color of the grid lines extending the ticks across the plot area.StringgetGridLineDashStyle()Returns the dash or dot style of the grid lines.NumbergetGridLineWidth()Returns the width of the grid lines extending the ticks across the plot area.NumbergetGridZIndex()Returns the Z index of the grid lines.StringgetId()Returns an id for the axis.AxisLabelsgetLabels()Returns the axis labels show the number or category for each tick.NumbergetLinkedTo()Returns index of another axis that this axis is linked to.NumbergetMargin()If there are multiple axes on the same side of the chart, returns the pixel margin between the axes.NumbergetMax()Returns the maximum value of the axis.NumbergetMaxPadding()Returns padding of the max value relative to the length of the axis.NumbergetMin()Returns the minimum value of the axis.ColorgetMinorGridLineColor()Returns color of the minor, secondary grid lines.StringgetMinorGridLineDashStyle()Returns the dash or dot style of the minor grid lines.NumbergetMinorGridLineWidth()Returns width of the minor, secondary grid lines.ColorgetMinorTickColor()Returns color for the minor tick marks.NumbergetMinorTickInterval()Returns the tick interval in scale units for the minor ticks.NumbergetMinorTickLength()Returns the pixel length of the minor tick marks.StringgetMinorTickPosition()Returns the position of the minor tick marks relative to the axis line.NumbergetMinorTicksPerMajor()Returns the number of minor ticks per major tick.NumbergetMinorTickWidth()Returns the pixel width of the minor tick mark.NumbergetMinPadding()Returns padding of the min value relative to the length of the axis.NumbergetMinRange()Returns the minimum range to display on this axis.NumbergetMinTickInterval()Returns the minimum tick interval allowed in axis values.NumbergetOffset()Returns the distance in pixels from the plot area to the axis line.NumbergetPane()Returns the index related to the paneList<PlotBand>getPlotBands()Returns a list of colored bands stretching across the plot area marking an interval on the axis.List<PlotLine>getPlotLines()Returns a list of lines streching across the plot area, marking a specific value on one of the axes.NumbergetSoftMax()Returns a soft maximum for the axis.NumbergetSoftMin()Returns a soft minimum for the axis.NumbergetStartOfWeek()Returns for datetime axes, this decides where to put the tick between weeks.NumbergetTickAmount()Get the amount of ticks to draw on the axis.StringgetTickColor()Returns color for the main tick marks.NumbergetTickInterval()Returns the interval of the tick marks in axis units.NumbergetTickLength()Returns the pixel length of the main tick marks.StringgetTickmarkPlacement()Returns for categorized axes only.NumbergetTickPixelInterval()Returns if tickInterval isnullthis option sets the approximate pixel interval of the tick marks.StringgetTickPosition()Returns the position of the major tick marks relative to the axis line.List<Number>getTickPositions()Returns a list defining where the ticks are laid out on the axis.NumbergetTickWidth()Returns the pixel width of the major tick marks.AxisTitlegetTitle()Returns the axis title, showing next to the axis line.StringgetType()Returns the type of axis.NumbergetZIndex()Returns the Z index for the axis group.booleanisAlignTicks()When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as ifgetTickAmount()were specified.booleanisAllowDecimals()Returns whether to allow decimals in this axis' ticks.booleanisAllowNegativeLog()Returns whether to allow zero or subzero values on a logarithmic axis.booleanisEndOnTick()Returns whether to force the axis to end on a tick.booleanisMinorTicks()Returns enable or disable minor ticks.booleanisOpposite()Returns whether to display the axis on the opposite side of the normal.BooleanisPanningEnabled()Returns whether to pan axis.booleanisReversed()Returns whether to reverse the axis so that the highest number is closest to the origin.booleanisReversedStacks()Returns how stacks should be ordered within a group.booleanisShowFirstLabel()Returns whether to show the first tick label.booleanisShowLastLabel()Returns whether to show the last tick label.booleanisStartOnTick()Returns whether to force the axis to start on a tick.booleanisUniqueNames()Applies only when the axis type is category.booleanisVisible()Returns whether axis, including axis title, line, ticks and labels, should be visible.booleanisZoomEnabled()Returns whether to zoom axis.voidonChange(OptionDataEvent event)Sent when the contents of the chart option has changed.voidremove()Removes the axis.voidremovePlotBand(String id)Removes a plot band with given id after render time.voidremovePlotBand(PlotBand plotBand)Removes a plot band after render time.voidremovePlotLine(String id)Removes a plot line with given id after render time.voidremovePlotLine(PlotLine plotLine)Removes a plot line after render time.voidsetAccessibility(AxisAccessibility accessibility)Sets an accessibility options for an axis.voidsetAlignTicks(boolean alignTicks)When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as ifgetTickAmount()were specified.voidsetAllowDecimals(boolean allowDecimals)Sets whether to allow decimals in this axis' ticks.voidsetAllowNegativeLog(boolean allowNegativeLog)Sets whether to allow zero or subzero values on a logarithmic axis.voidsetAlternateGridColor(String color)Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.voidsetAlternateGridColor(Color color)Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.voidsetAlternateGridColor(LinearGradient color)Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.voidsetAlternateGridColor(RadialGradient color)Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.voidsetAngle(Number angle)Sets the angle of the Y axis in degrees.voidsetCategories(String... categories)Sets categories are present for the Axis, names are used instead of numbers for that axis.voidsetCategories(List<String> categories)Sets categories are present for the Axis, names are used instead of numbers for that axis.voidsetCeiling(Number ceiling)Sets the highest allowed value for automatically computed axis extremes.voidsetClassName(String className)Sets a class name that opens for styling the axis by CSS, especially in Highcharts styled mode.voidsetCrossing(Number crossing)Sets the value on a perpendicular axis where this axis should cross.voidsetDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)Sets for a datetime axis, the scale will automatically adjust to the appropriate unit.voidsetEndOnTick(boolean endOnTick)Sets whether to force the axis to end on a tick.voidsetExtremes(Number min, Number max)voidsetExtremes(Number min, Number max, boolean redraw, Animation animation)Sets the minimum and maximum of the axes after render time.voidsetFloor(Number floor)Sets the lowest allowed value for automatically computed axis extremes.voidsetGridLineColor(String color)Sets color of the grid lines extending the ticks across the plot area.voidsetGridLineColor(Color color)Sets color of the grid lines extending the ticks across the plot area.voidsetGridLineColor(LinearGradient color)Sets color of the grid lines extending the ticks across the plot area.voidsetGridLineColor(RadialGradient color)Sets color of the grid lines extending the ticks across the plot area.voidsetGridLineDashStyle(String gridLineDashStyle)Sets the dash or dot style of the grid lines.voidsetGridLineWidth(Number gridLineWidth)Sets the width of the grid lines extending the ticks across the plot area.voidsetGridZIndex(Number gridZIndex)Sets the Z index of the grid lines.voidsetId(String id)Sets an id for the axis.voidsetLabels(AxisLabels labels)Sets the axis labels show the number or category for each tick.voidsetLinkedTo(Number linkedTo)Sets index of another axis that this axis is linked to.voidsetMargin(Number margin)If there are multiple axes on the same side of the chart, sets the pixel margin between the axes.voidsetMax(Number max)Sets the maximum value of the axis.voidsetMaxPadding(Number maxPadding)Sets padding of the max value relative to the length of the axis.voidsetMin(Number min)Sets the minimum value of the axis.voidsetMinorGridLineColor(String color)Sets color of the minor, secondary grid lines.voidsetMinorGridLineColor(Color color)Sets color of the minor, secondary grid lines.voidsetMinorGridLineColor(LinearGradient color)Sets color of the minor, secondary grid lines.voidsetMinorGridLineColor(RadialGradient color)Sets color of the minor, secondary grid lines.voidsetMinorGridLineDashStyle(String minorGridLineDashStyle)Sets the dash or dot style of the minor grid lines.voidsetMinorGridLineWidth(Number minorGridLineWidth)Sets width of the minor, secondary grid lines.voidsetMinorTickColor(String color)Sets color for the minor tick marks.voidsetMinorTickColor(Color color)Sets color for the minor tick marks.voidsetMinorTickColor(LinearGradient color)Sets color for the minor tick marks.voidsetMinorTickColor(RadialGradient color)Sets color for the minor tick marks.voidsetMinorTickInterval(Number minorTickInterval)Sets tick interval in scale units for the minor ticks.voidsetMinorTickInterval(String minorTickInterval)Sets tick interval in scale units for the minor ticks.voidsetMinorTickLength(Number minorTickLength)Sets the pixel length of the minor tick marks.voidsetMinorTickPosition(String minorTickPosition)Sets the position of the minor tick marks relative to the axis line.voidsetMinorTicks(boolean minorTicks)Sets enable or disable minor ticks.voidsetMinorTicksPerMajor(Number minorTicksPerMajor)Sets the number of minor ticks per major tick.voidsetMinorTickWidth(Number minorTickWidth)Sets the pixel width of the minor tick mark.voidsetMinPadding(Number minPadding)Sets padding of the min value relative to the length of the axis.voidsetMinRange(Number minRange)Sets the minimum range to display on this axis.voidsetMinTickInterval(Number minTickInterval)Sets the minimum tick interval allowed in axis values.voidsetOffset(Number offset)Sets the distance in pixels from the plot area to the axis line.voidsetOpposite(boolean opposite)Sets whether to display the axis on the opposite side of the normal.voidsetPane(Number pane)Sets the axis to link to the index of the pane.voidsetPanningEnabled(Boolean panningEnabled)Sets whether to pan axis.voidsetPlotBands(List<PlotBand> plotBands)Sets a list of colored bands stretching across the plot area marking an interval on the axis.voidsetPlotBands(PlotBand... plotBands)Sets a list of colored bands stretching across the plot area marking an interval on the axis.voidsetPlotLines(List<PlotLine> plotLines)Sets a list of lines streching across the plot area, marking a specific value on one of the axes.voidsetPlotLines(PlotLine... plotLines)Sets a list of lines streching across the plot area, marking a specific value on one of the axes.voidsetReversed(boolean reversed)Sets whether to reverse the axis so that the highest number is closest to the origin.voidsetReversedStacks(boolean reversedStacks)Sets how stacks should be ordered within a group.voidsetShowFirstLabel(boolean showFirstLabel)Sets whether to show the first tick label.voidsetShowLastLabel(boolean showLastLabel)Sets whether to show the last tick label.voidsetSoftMax(Number softMax)Sets a soft maximum for the axis.voidsetSoftMin(Number softMin)Sets a soft minimum for the axis.voidsetStartOfWeek(Number startOfWeek)Sets for datetime axes, this decides where to put the tick between weeks.voidsetStartOnTick(boolean startOnTick)Sets whether to force the axis to start on a tick.voidsetTickAmount(Number tickAmount)Set the amount of ticks to draw on the axis.voidsetTickColor(String tickColor)Sets color for the main tick marks.voidsetTickInterval(Number tickInterval)Sets the interval of the tick marks in axis units.voidsetTickLength(Number tickLength)Sets the pixel length of the main tick marks.voidsetTickmarkPlacement(String tickmarkPlacement)Sets for categorized axes only.voidsetTickPixelInterval(Number tickPixelInterval)Sets if tickInterval isnullthis option sets the approximate pixel interval of the tick marks.voidsetTickPosition(String tickPosition)Sets the position of the major tick marks relative to the axis line.voidsetTickPositions(List<Number> tickPositions)Sets a list defining where the ticks are laid out on the axis.voidsetTickWidth(Number tickWidth)Sets the pixel width of the major tick marks.voidsetTitle(String title)Sets the title text of the axis.voidsetTitle(AxisTitle title)Sets the axis title, showing next to the axis line.voidsetType(String type)Sets the type of axis.voidsetUniqueNames(boolean uniqueNames)Applies only when the axis type is category.voidsetVisible(boolean visible)Sets whether axis, including axis title, line, ticks and labels, should be visible.voidsetZIndex(Number zIndex)Sets the Z index for the axis group.voidsetZoomEnabled(boolean zoomEnabled)Sets whether to zoom axis.-
Methods inherited from class org.zkoss.chart.Optionable
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, setAttr, toJSONString, toString
-
-
-
-
Method Detail
-
getAccessibility
public AxisAccessibility getAccessibility()
Returns an accessibility options for an axis, if null, it will create new one.- Since:
- 10.2.1.0
-
setAccessibility
public void setAccessibility(AxisAccessibility accessibility)
Sets an accessibility options for an axis.- Since:
- 10.2.1.0
-
setExtremes
public void setExtremes(Number min, Number max, boolean redraw, Animation animation)
Sets the minimum and maximum of the axes after render time. 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 setExtremes. Also, setExtremes will not allow a range lower than the minRange option, which by default is the range of five points.- Parameters:
min-max-
-
isAlignTicks
public boolean isAlignTicks()
When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as ifgetTickAmount()were specified. This can be prevented by settingalignTicksto false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by settingsetGridLineWidth(Number)to 0. IfisStartOnTick()orisEndOnTick()in an Axis options are set to false, then thealignTickswill be disabled for the Axis. Disabled for logarithmic axes.Default: true
- Since:
- 7.2.1.0
-
setAlignTicks
public void setAlignTicks(boolean alignTicks)
When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as ifgetTickAmount()were specified. This can be prevented by settingalignTicksto false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by settingsetGridLineWidth(Number)to 0. IfisStartOnTick()orisEndOnTick()in an Axis options are set to false, then thealignTickswill be disabled for the Axis. Disabled for logarithmic axes.- Since:
- 7.2.1.0
-
isAllowDecimals
public boolean isAllowDecimals()
Returns 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.Default: true.
-
setAllowDecimals
public void setAllowDecimals(boolean allowDecimals)
Sets 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.
-
isAllowNegativeLog
public boolean isAllowNegativeLog()
Returns whether to allow zero or subzero values on a logarithmic axis.Default: false
- Since:
- 7.2.1.0
-
setAllowNegativeLog
public void setAllowNegativeLog(boolean allowNegativeLog)
Sets whether to allow zero or subzero values on a logarithmic axis.- Since:
- 7.2.1.0
-
getAlternateGridColor
public Color getAlternateGridColor()
Returns when using an alternate grid color, a band is painted across the plot area between every other grid line.Default: null.
-
setAlternateGridColor
public void setAlternateGridColor(Color color)
Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.
-
getAngle
public Number getAngle()
Returns the angle of the Y axis in degrees.In a polar chart, this is the angle of the Y axis in degrees, where 0 is up and 90 is right. The angle determines the position of the axis line and the labels, though the coordinate system is unaffected.
Default: 0
- Since:
- 11.2.0.0
-
setAngle
public void setAngle(Number angle)
Sets the angle of the Y axis in degrees.In a polar chart, this is the angle of the Y axis in degrees, where 0 is up and 90 is right. The angle determines the position of the axis line and the labels, though the coordinate system is unaffected.
- Since:
- 11.2.0.0
-
setAlternateGridColor
public void setAlternateGridColor(String color)
Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.
-
setAlternateGridColor
public void setAlternateGridColor(LinearGradient color)
Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.
-
setAlternateGridColor
public void setAlternateGridColor(RadialGradient color)
Sets when using an alternate grid color, a band is painted across the plot area between every other grid line.
-
getCategories
public List<String> getCategories()
Returns the categories in a list. Categories can also be extracted by giving each point a name and setting axis type to category. However, if you have multiple series, best practice remains defining the categories array.Default: null
-
setCategories
public void setCategories(List<String> categories)
Sets categories are present for the Axis, names are used instead of numbers for that axis.Defaults: null
- See Also:
setCategories(String...),getCategories()
-
setCategories
public void setCategories(String... categories)
Sets categories are present for the Axis, names are used instead of numbers for that axis.Defaults: null
- See Also:
setCategories(List),getCategories()
-
getCeiling
public Number getCeiling()
Returns the highest allowed value for automatically computed axis extremes.Default: null.
-
setCeiling
public void setCeiling(Number ceiling)
Sets the highest allowed value for automatically computed axis extremes.
-
getClassName
public String getClassName()
Returns a class name that opens for styling the axis by CSS, especially in Highcharts styled mode. The class name is applied to group elements for the grid, axis elements and labels.Default:
null- Since:
- 10.2.1.0
-
setClassName
public void setClassName(String className)
Sets a class name that opens for styling the axis by CSS, especially in Highcharts styled mode. The class name is applied to group elements for the grid, axis elements and labels.Default:
null- Since:
- 10.2.1.0
-
getCrossing
public Number getCrossing()
Returns the value on a perpendicular axis where this axis should cross. This is typically used on mathematical plots where the axes cross at 0. When crossing is set, space will not be reserved at the sides of the chart for axis labels and title, so those may be clipped. In this case it is better to place the axes without the crossing option.Default:
null- Since:
- 11.2.0.0
-
setCrossing
public void setCrossing(Number crossing)
Sets the value on a perpendicular axis where this axis should cross. This is typically used on mathematical plots where the axes cross at 0. When crossing is set, space will not be reserved at the sides of the chart for axis labels and title, so those may be clipped. In this case it is better to place the axes without the crossing option.Default:
null- Since:
- 11.2.0.0
-
getDateTimeLabelFormats
public DateTimeLabelFormats getDateTimeLabelFormats()
Returns for a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default string representations used for each unit. For an overview of the replacement codes, see dateFormat. Defaults to:{ millisecond: '%H:%M:%S.%L', second: '%H:%M:%S', minute: '%H:%M', hour: '%H:%M', day: '%e. %b', week: '%e. %b', month: '%b \'%y', year: '%Y' }
-
setDateTimeLabelFormats
public void setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
Sets for a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default string representations used for each unit. For an overview of the replacement codes, see dateFormat. Defaults to:{ millisecond: '%H:%M:%S.%L', second: '%H:%M:%S', minute: '%H:%M', hour: '%H:%M', day: '%e. %b', week: '%e. %b', month: '%b \'%y', year: '%Y' }
-
isEndOnTick
public boolean isEndOnTick()
Returns whether to force the axis to end on a tick. Use this option with themaxPaddingoption to control the axis end.Default: false.
- Returns:
- endOnTick whether to force the axis to end on a tick
-
setEndOnTick
public void setEndOnTick(boolean endOnTick)
Sets whether to force the axis to end on a tick. Use this option with themaxPaddingoption to control the axis end.- Parameters:
endOnTick- whether to force the axis to end on a tick
-
getFloor
public Number getFloor()
Returns the lowest allowed value for automatically computed axis extremes.Default: null.
-
setFloor
public void setFloor(Number floor)
Sets the lowest allowed value for automatically computed axis extremes.
-
getGridLineColor
public Color getGridLineColor()
Returns color of the grid lines extending the ticks across the plot area.Default: #C0C0C0.
-
setGridLineColor
public void setGridLineColor(Color color)
Sets color of the grid lines extending the ticks across the plot area.
-
setGridLineColor
public void setGridLineColor(String color)
Sets color of the grid lines extending the ticks across the plot area.
-
setGridLineColor
public void setGridLineColor(LinearGradient color)
Sets color of the grid lines extending the ticks across the plot area.
-
setGridLineColor
public void setGridLineColor(RadialGradient color)
Sets color of the grid lines extending the ticks across the plot area.
-
getGridLineDashStyle
public String getGridLineDashStyle()
Returns the dash or dot style of the grid lines. For possible values,Solid,ShortDash,ShortDot,ShortDashDot,ShortDashDotDot,Dot,Dash,LongDash,DashDot,LongDashDot, andLongDashDotDot.Default: "Solid".
-
setGridLineDashStyle
public void setGridLineDashStyle(String gridLineDashStyle)
Sets the dash or dot style of the grid lines. For possible values,Solid,ShortDash,ShortDot,ShortDashDot,ShortDashDotDot,Dot,Dash,LongDash,DashDot,LongDashDot, andLongDashDotDot.
-
getGridLineWidth
public Number getGridLineWidth()
Returns the width of the grid lines extending the ticks across the plot area.Default: null.
-
setGridLineWidth
public void setGridLineWidth(Number gridLineWidth)
Sets the width of the grid lines extending the ticks across the plot area.
-
getGridZIndex
public Number getGridZIndex()
Returns the Z index of the grid lines. Defaults to 1.Default: 1.
-
setGridZIndex
public void setGridZIndex(Number gridZIndex)
Sets the Z index of the grid lines. Defaults to 1.
-
getId
public String getId()
Returns an id for the axis.Default: null.
-
setId
public void setId(String id)
Sets an id for the axis.
-
getLabels
public AxisLabels getLabels()
Returns the axis labels show the number or category for each tick.
-
setLabels
public void setLabels(AxisLabels labels)
Sets the axis labels show the number or category for each tick.- Parameters:
labels- the axis labels show the number or category for each tick
-
getLinkedTo
public Number getLinkedTo()
Returns 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 min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.Default: null.
-
setLinkedTo
public void setLinkedTo(Number linkedTo)
Sets 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 min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.
-
getMargin
public Number getMargin()
If there are multiple axes on the same side of the chart, returns the pixel margin between the axes.Default: 0 on vertical axes, 15 on horizontal axes
- Since:
- 7.2.1.0
-
setMargin
public void setMargin(Number margin)
If there are multiple axes on the same side of the chart, sets the pixel margin between the axes.- Since:
- 7.2.1.0
-
getMax
public Number getMax()
Returns the maximum value of the axis. If-1, the max value is automatically calculated. If theendOnTickoption is true, themaxvalue might be rounded up. The actual maximum value is also influenced byChart.isAlignTicks().Default: null
-
setMax
public void setMax(Number max)
Sets the maximum value of the axis. If-1, the max value is automatically calculated. If theendOnTickoption is true, themaxvalue might be rounded up. The actual maximum value is also influenced byChart.isAlignTicks().
-
getMaxPadding
public Number getMaxPadding()
Returns 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 thesetMax(Number)option is set or a max extreme is set usingsetExtremes(Number, Number), the maxPadding will be ignored.Default: 0.01.
-
setMaxPadding
public void setMaxPadding(Number maxPadding)
Sets 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 thesetMax(Number)option is set or a max extreme is set usingsetExtremes(Number, Number), the maxPadding will be ignored.
-
getMin
public Number getMin()
Returns the minimum value of the axis. Ifnullthe min value is automatically calculated. If thesetStartOnTick(boolean)option is true, theminvalue might be rounded down.Default: null.
-
setMin
public void setMin(Number min)
Sets the minimum value of the axis. Ifnullthe min value is automatically calculated. If thesetStartOnTick(boolean)option is true, theminvalue might be rounded down.
-
getMinPadding
public Number getMinPadding()
Returns 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 lowest data value to appear on the edge of the plot area. When thesetMin(Number)option is set or a min extreme is set usingsetExtremes(Number, Number), the minPadding will be ignored.Default: 0.01.
-
setMinPadding
public void setMinPadding(Number minPadding)
Sets 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 lowest data value to appear on the edge of the plot area. When thesetMin(Number)option is set or a min extreme is set usingsetExtremes(Number, Number), the minPadding will be ignored.
-
getMinRange
public Number getMinRange()
Returns the minimum range to display 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 minRange is set to 3600000, you can't zoom in more than to one hour.The default minRange for the x axis is five times the smallest interval between any of the data points.
On a logarithmic axis, the unit for the minimum range is the power. So a minRange of 1 means that the axis can be zoomed to 10-100, 100-1000, 1000-10000 etc.
Default: null
-
setMinRange
public void setMinRange(Number minRange)
Sets the minimum range to display 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 minRange is set to 3600000, you can't zoom in more than to one hour.The default minRange for the x axis is five times the smallest interval between any of the data points.
On a logarithmic axis, the unit for the minimum range is the power. So a minRange of 1 means that the axis can be zoomed to 10-100, 100-1000, 1000-10000 etc.
Default: null.
-
getMinTickInterval
public Number getMinTickInterval()
Returns the minimum tick interval allowed in axis values. For example on zooming in on an axis with daily data, this can be used to prevent the axis from showing hours.Default: null
-
setMinTickInterval
public void setMinTickInterval(Number minTickInterval)
Sets the minimum tick interval allowed in axis values. For example on zooming in on an axis with daily data, this can be used to prevent the axis from showing hours.Default: null
-
getMinorGridLineColor
public Color getMinorGridLineColor()
Returns color of the minor, secondary grid lines.Default: "#E0E0E0".
-
setMinorGridLineColor
public void setMinorGridLineColor(Color color)
Sets color of the minor, secondary grid lines.
-
setMinorGridLineColor
public void setMinorGridLineColor(String color)
Sets color of the minor, secondary grid lines.
-
setMinorGridLineColor
public void setMinorGridLineColor(LinearGradient color)
Sets color of the minor, secondary grid lines.
-
setMinorGridLineColor
public void setMinorGridLineColor(RadialGradient color)
Sets color of the minor, secondary grid lines.
-
getMinorGridLineDashStyle
public String getMinorGridLineDashStyle()
Returns the dash or dot style of the minor grid lines. For possible values,Solid,ShortDash,ShortDot,ShortDashDot,ShortDashDotDot,Dot,Dash,LongDash,DashDot,LongDashDot, andLongDashDotDot.Default: "Solid".
-
setMinorGridLineDashStyle
public void setMinorGridLineDashStyle(String minorGridLineDashStyle)
Sets the dash or dot style of the minor grid lines. For possible values,Solid,ShortDash,ShortDot,ShortDashDot,ShortDashDotDot,Dot,Dash,LongDash,DashDot,LongDashDot, andLongDashDotDot.
-
getMinorGridLineWidth
public Number getMinorGridLineWidth()
Returns width of the minor, secondary grid lines.Default: 1.
-
setMinorGridLineWidth
public void setMinorGridLineWidth(Number minorGridLineWidth)
Sets width of the minor, secondary grid lines.
-
isMinorTicks
public boolean isMinorTicks()
Returns enable or disable minor ticks. Unless minorTickInterval is set, the tick interval is calculated as a fifth of the tickInterval. On a logarithmic axis, minor ticks are laid out based on a best guess, attempting to enter approximately 5 minor ticks between each major tick. On axes using categories, minor ticks are not supported.Default: false
- Since:
- 7.2.1.0
-
setMinorTicks
public void setMinorTicks(boolean minorTicks)
Sets enable or disable minor ticks. Unless minorTickInterval is set, the tick interval is calculated as a fifth of the tickInterval. On a logarithmic axis, minor ticks are laid out based on a best guess, attempting to enter approximately 5 minor ticks between each major tick. On axes using categories, minor ticks are not supported.- Since:
- 7.2.1.0
-
getMinorTickColor
public Color getMinorTickColor()
Returns color for the minor tick marks.Default: "#A0A0A0".
-
setMinorTickColor
public void setMinorTickColor(Color color)
Sets color for the minor tick marks.
-
setMinorTickColor
public void setMinorTickColor(String color)
Sets color for the minor tick marks.
-
setMinorTickColor
public void setMinorTickColor(LinearGradient color)
Sets color for the minor tick marks.
-
setMinorTickColor
public void setMinorTickColor(RadialGradient color)
Sets color for the minor tick marks.
-
getMinorTickInterval
public Number getMinorTickInterval()
Returns the tick interval in scale units for the minor ticks. On a linear axis, if"auto", the minor tick interval is calculated as a fifth of the tickInterval. Ifnull, minor ticks are not shown.On logarithmic axes, the unit is the power of the value. For example, setting the minorTickInterval to 1 puts one tick on each of 0.1, 1, 10, 100 etc. Setting the minorTickInterval to 0.1 produces 9 ticks between 1 and 10, 10 and 100 etc. A minorTickInterval of "auto" on a log axis results in a best guess, attempting to enter approximately 5 minor ticks between each major tick.
On axes using
setCategories(List), minor ticks are not supported.Default: null.
-
setMinorTickInterval
public void setMinorTickInterval(Number minorTickInterval)
Sets tick interval in scale units for the minor ticks. On a linear axis, if"auto", the minor tick interval is calculated as a fifth of the tickInterval. Ifnull, minor ticks are not shown.On logarithmic axes, the unit is the power of the value. For example, setting the minorTickInterval to 1 puts one tick on each of 0.1, 1, 10, 100 etc. Setting the minorTickInterval to 0.1 produces 9 ticks between 1 and 10, 10 and 100 etc. A minorTickInterval of "auto" on a log axis results in a best guess, attempting to enter approximately 5 minor ticks between each major tick.
On axes using
setCategories(List), minor ticks are not supported.
-
setMinorTickInterval
public void setMinorTickInterval(String minorTickInterval)
Sets tick interval in scale units for the minor ticks. On a linear axis, if"auto", the minor tick interval is calculated as a fifth of the tickInterval. Ifnull, minor ticks are not shown.On logarithmic axes, the unit is the power of the value. For example, setting the minorTickInterval to 1 puts one tick on each of 0.1, 1, 10, 100 etc. Setting the minorTickInterval to 0.1 produces 9 ticks between 1 and 10, 10 and 100 etc. A minorTickInterval of "auto" on a log axis results in a best guess, attempting to enter approximately 5 minor ticks between each major tick.
On axes using
setCategories(List), minor ticks are not supported.
-
getMinorTickLength
public Number getMinorTickLength()
Returns the pixel length of the minor tick marks.Default: 2.
- Returns:
- minorTickLength the pixel length of the minor tick marks
-
setMinorTickLength
public void setMinorTickLength(Number minorTickLength)
Sets the pixel length of the minor tick marks.
-
getMinorTickPosition
public String getMinorTickPosition()
Returns the position of the minor tick marks relative to the axis line. Can be one ofinsideandoutside.Default: "outside".
- Returns:
- minorTickPosition the position of the minor tick marks relative to the axis line
-
setMinorTickPosition
public void setMinorTickPosition(String minorTickPosition)
Sets the position of the minor tick marks relative to the axis line. Can be one ofinsideandoutside.- Parameters:
minorTickPosition- the position of the minor tick marks relative to the axis line
-
getMinorTickWidth
public Number getMinorTickWidth()
Returns the pixel width of the minor tick mark.Default: null.
-
setMinorTickWidth
public void setMinorTickWidth(Number minorTickWidth)
Sets the pixel width of the minor tick mark.
-
getOffset
public Number getOffset()
Returns 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.Default: undefined.
-
setOffset
public void setOffset(Number offset)
Sets 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.
-
isOpposite
public boolean isOpposite()
Returns 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.Default: false.
-
setOpposite
public void setOpposite(boolean opposite)
Sets 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.
-
getPane
public Number getPane()
Returns the index related to the paneThis option is applied to Gauge chart type only.
Default: 0
-
setPane
public void setPane(Number pane)
Sets the axis to link to the index of the pane.This option is applied to Gauge chart type only.
-
isPanningEnabled
public Boolean isPanningEnabled()
Returns whether to pan axis. Ifchart.panningis enabled, the option allows to disable panning on an individual axis.Default: true
- Since:
- 11.2.0.0
-
setPanningEnabled
public void setPanningEnabled(Boolean panningEnabled)
Sets whether to pan axis. Ifchart.panningis enabled, the option allows to disable panning on an individual axis.- Since:
- 11.2.0.0
-
getPlotBands
public List<PlotBand> getPlotBands()
Returns a list of colored bands stretching across the plot area marking an interval on the axis.In a gauge, a plot band on the Y axis (value axis) will stretch along the perimiter of the gauge.
Default: null.
-
setPlotBands
public void setPlotBands(PlotBand... plotBands)
Sets a list of colored bands stretching across the plot area marking an interval on the axis.In a gauge, a plot band on the Y axis (value axis) will stretch along the perimiter of the gauge.
Default: null.
- Since:
- 10.2.1.0
-
setPlotBands
public void setPlotBands(List<PlotBand> plotBands)
Sets a list of colored bands stretching across the plot area marking an interval on the axis.In a gauge, a plot band on the Y axis (value axis) will stretch along the perimiter of the gauge.
Default: null.
-
addPlotBand
public void addPlotBand(PlotBand plotBand)
Adds a plot band after render time.- Parameters:
plotBand-
-
removePlotBand
public void removePlotBand(String id)
Removes a plot band with given id after render time.
-
removePlotBand
public void removePlotBand(PlotBand plotBand)
Removes a plot band after render time.
-
getPlotLines
public List<PlotLine> getPlotLines()
Returns a list of lines streching across the plot area, marking a specific value on one of the axes.Default: null.
-
setPlotLines
public void setPlotLines(PlotLine... plotLines)
Sets a list of lines streching across the plot area, marking a specific value on one of the axes.- Since:
- 10.2.1.0
-
setPlotLines
public void setPlotLines(List<PlotLine> plotLines)
Sets a list of lines streching across the plot area, marking a specific value on one of the axes.
-
addPlotLine
public void addPlotLine(PlotLine plotLine)
Adds a plot line after render time.
-
removePlotLine
public void removePlotLine(String id)
Removes a plot line with given id after render time.
-
removePlotLine
public void removePlotLine(PlotLine plotLine)
Removes a plot line after render time.
-
isReversed
public boolean isReversed()
Returns whether to reverse the axis so that the highest number is closest to the origin. If the chart is inverted, the x axis is reversed by default.Default: null.
-
setReversed
public void setReversed(boolean reversed)
Sets whether to reverse the axis so that the highest number is closest to the origin. If the chart is inverted, the x axis is reversed by default.
-
isReversedStacks
public boolean isReversedStacks()
Returns how stacks should be ordered within a group. For example reversed xAxis also reverses stacks, so first series comes last in a group. To keep order like for non-reversed xAxis enable this option.Default: false
- Since:
- 7.2.1.0
-
setReversedStacks
public void setReversedStacks(boolean reversedStacks)
Sets how stacks should be ordered within a group. For example reversed xAxis also reverses stacks, so first series comes last in a group. To keep order like for non-reversed xAxis enable this option.- Since:
- 7.2.1.0
-
isShowFirstLabel
public boolean isShowFirstLabel()
Returns whether to show the first tick label.Default: true.
-
setShowFirstLabel
public void setShowFirstLabel(boolean showFirstLabel)
Sets whether to show the first tick label.
-
isShowLastLabel
public boolean isShowLastLabel()
Returns whether to show the last tick label.Default: false.
-
setShowLastLabel
public void setShowLastLabel(boolean showLastLabel)
Sets whether to show the last tick label.
-
getSoftMax
public Number getSoftMax()
Returns a soft maximum for the axis. If the series data maximum is less than this, the axis will stay at this maximum, but if the series data maximum is higher, the axis will flex to show all data. Note: TheSeriesPlotOptions.setSoftThreshold(boolean)option takes precedence over this option.Default: null
-
setSoftMax
public void setSoftMax(Number softMax)
Sets a soft maximum for the axis. If the series data maximum is less than this, the axis will stay at this maximum, but if the series data maximum is higher, the axis will flex to show all data. Note: TheSeriesPlotOptions.setSoftThreshold(boolean)option takes precedence over this option.
-
getSoftMin
public Number getSoftMin()
Returns a soft minimum for the axis. If the series data minimum is greater than this, the axis will stay at this minimum, but if the series data minimum is lower, the axis will flex to show all data. Note: TheSeriesPlotOptions.setSoftThreshold(boolean)option takes precedence over this option.Default: null
-
setSoftMin
public void setSoftMin(Number softMin)
Sets a soft minimum for the axis. If the series data minimum is greater than this, the axis will stay at this minimum, but if the series data minimum is lower, the axis will flex to show all data. Note: TheSeriesPlotOptions.setSoftThreshold(boolean)option takes precedence over this option.
-
getStartOfWeek
public Number getStartOfWeek()
Returns for datetime axes, this decides where to put the tick between weeks. 0 = Sunday, 1 = Monday.Default: 1.
-
setStartOfWeek
public void setStartOfWeek(Number startOfWeek)
Sets for datetime axes, this decides where to put the tick between weeks. 0 = Sunday, 1 = Monday.
-
isStartOnTick
public boolean isStartOnTick()
Returns whether to force the axis to start on a tick. Use this option with themaxPaddingoption to control the axis start.Default: false.
-
setStartOnTick
public void setStartOnTick(boolean startOnTick)
Sets whether to force the axis to start on a tick. Use this option with thesetMaxPadding(Number)option to control the axis start.
-
getTickAmount
public Number getTickAmount()
Get the amount of ticks to draw on the axis. This opens up for aligning the ticks of multiple charts or panes within a chart. This option overrides the tickPixelInterval option.This option only has an effect on linear axes. Datetime, logarithmic or category axes are not affected.
- Since:
- 2.1.1
-
setTickAmount
public void setTickAmount(Number tickAmount)
Set the amount of ticks to draw on the axis. This opens up for aligning the ticks of multiple charts or panes within a chart. This option overrides the tickPixelInterval option.This option only has an effect on linear axes. Datetime, logarithmic or category axes are not affected.
- Since:
- 2.1.1
-
getTickColor
public String getTickColor()
Returns color for the main tick marks.Default: "#C0D0E0".
-
setTickColor
public void setTickColor(String tickColor)
Sets color for the main tick marks.
-
getTickInterval
public Number getTickInterval()
Returns the interval of the tick marks in axis units. Whennull, the tick interval is computed to approximately follow thesetTickPixelInterval(Number)on linear and datetime axes. On categorized axes, anulltickInterval will default to 1, one category. Note that datetime axes are based on milliseconds, so for example an interval of one day is expressed as24 * 3600 * 1000.On logarithmic axes, the tickInterval is based on powers, so a tickInterval of 1 means one tick on each of 0.1, 1, 10, 100 etc. A tickInterval of 2 means a tick of 0.1, 10, 1000 etc. A tickInterval of 0.2 puts a tick on 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 20, 40 etc.
Default: null.
-
setTickInterval
public void setTickInterval(Number tickInterval)
Sets the interval of the tick marks in axis units. Whennull, the tick interval is computed to approximately follow thesetTickPixelInterval(Number)on linear and datetime axes. On categorized axes, anulltickInterval will default to 1, one category. Note that datetime axes are based on milliseconds, so for example an interval of one day is expressed as24 * 3600 * 1000.On logarithmic axes, the tickInterval is based on powers, so a tickInterval of 1 means one tick on each of 0.1, 1, 10, 100 etc. A tickInterval of 2 means a tick of 0.1, 10, 1000 etc. A tickInterval of 0.2 puts a tick on 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 20, 40 etc.
Default: null.
-
getTickLength
public Number getTickLength()
Returns the pixel length of the main tick marks.Default: 5.
-
setTickLength
public void setTickLength(Number tickLength)
Sets the pixel length of the main tick marks.
-
getTickPixelInterval
public Number getTickPixelInterval()
Returns if tickInterval isnullthis option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to72for the Y axis and100for the X axis.Default: null.
-
setTickPixelInterval
public void setTickPixelInterval(Number tickPixelInterval)
Sets if tickInterval isnullthis option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to72for the Y axis and100for the X axis.Default: null.
-
getTickPosition
public String getTickPosition()
Returns the position of the major tick marks relative to the axis line. Can be one ofinsideandoutside.Default: "outside".
- Returns:
- tickPosition the position of the major tick marks relative to the axis line
-
setTickPosition
public void setTickPosition(String tickPosition)
Sets the position of the major tick marks relative to the axis line. Can be one ofinsideandoutside.
-
getTickPositions
public List<Number> getTickPositions()
Returns a list defining where the ticks are laid out on the axis. This overrides the default behaviour ofsetTickPixelInterval(Number)andsetTickInterval(Number)Default: null.
-
setTickPositions
public void setTickPositions(List<Number> tickPositions)
Sets a list defining where the ticks are laid out on the axis. This overrides the default behaviour ofsetTickPixelInterval(Number)andsetTickInterval(Number)Default: null.
-
getTickWidth
public Number getTickWidth()
Returns the pixel width of the major tick marks.Default: null.
-
setTickWidth
public void setTickWidth(Number tickWidth)
Sets the pixel width of the major tick marks.
-
getTickmarkPlacement
public String getTickmarkPlacement()
Returns for categorized axes only. If "on" the tick mark is placed in the center of the category, if "between" the tick mark is placed between categories.Default: "between".
-
setTickmarkPlacement
public void setTickmarkPlacement(String tickmarkPlacement)
Sets for categorized axes only. If "on" the tick mark is placed in the center of the category, if "between" the tick mark is placed between categories.
-
getTitle
public AxisTitle getTitle()
Returns the axis title, showing next to the axis line.Default: an instance of
AxisTitle.
-
setTitle
public void setTitle(AxisTitle title)
Sets the axis title, showing next to the axis line.
-
setTitle
public void setTitle(String title)
Sets the title text of the axis.
-
getType
public String getType()
Returns the type of axis. Can be one of"linear","logarithmic","datetime"or"category". In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days. In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined.Default: "linear".
-
setType
public void setType(String type)
Sets the type of axis. Can be one of"linear","logarithmic","datetime"or"category". In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days. In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined.
-
isUniqueNames
public boolean isUniqueNames()
Applies only when the axis type is category. When uniqueNames is true, points are placed on the X axis according to their names. If the same point name is repeated in the same or another series, the point is placed on the same X position as other points of the same name. When uniqueNames is false, the points are laid out in increasing X positions regardless of their names, and the X axis category will take the name of the last point in each position.Default: true
- Since:
- 7.2.1.0
-
setUniqueNames
public void setUniqueNames(boolean uniqueNames)
Applies only when the axis type is category. When uniqueNames is true, points are placed on the X axis according to their names. If the same point name is repeated in the same or another series, the point is placed on the same X position as other points of the same name. When uniqueNames is false, the points are laid out in increasing X positions regardless of their names, and the X axis category will take the name of the last point in each position.- Since:
- 7.2.1.0
-
isVisible
public boolean isVisible()
Returns whether axis, including axis title, line, ticks and labels, should be visible.Default: true
- Since:
- 7.2.1.0
-
setVisible
public void setVisible(boolean visible)
Sets whether axis, including axis title, line, ticks and labels, should be visible.- Since:
- 7.2.1.0
-
isZoomEnabled
public boolean isZoomEnabled()
Returns whether to zoom axis. If chart.zoomType is set, the option allows to disable zooming on an individual axis.Default: true
- Since:
- 7.2.1.0
-
setZoomEnabled
public void setZoomEnabled(boolean zoomEnabled)
Sets whether to zoom axis. If chart.zoomType is set, the option allows to disable zooming on an individual axis.- Since:
- 7.2.1.0
-
remove
public void remove()
Removes the axis.
-
onChange
public void onChange(OptionDataEvent event)
Description copied from interface:OptionDataListenerSent when the contents of the chart option has changed.- Specified by:
onChangein interfaceOptionDataListener- Overrides:
onChangein classOptionable
-
getMinorTicksPerMajor
public Number getMinorTicksPerMajor()
Returns the number of minor ticks per major tick. Works for linear, logarithmic and datetime axes.Default: 5
- Since:
- 11.2.0.0
-
setMinorTicksPerMajor
public void setMinorTicksPerMajor(Number minorTicksPerMajor)
Sets the number of minor ticks per major tick. Works for linear, logarithmic and datetime axes.- Since:
- 11.2.0.0
-
getZIndex
public Number getZIndex()
Returns the Z index for the axis group.Default: 2
- Since:
- 11.2.0.0
-
setZIndex
public void setZIndex(Number zIndex)
Sets the Z index for the axis group.- Since:
- 11.2.0.0
-
-