Package org.zkoss.chart
Class YAxis
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Axis
-
- org.zkoss.chart.XAxis
-
- org.zkoss.chart.YAxis
-
- All Implemented Interfaces:
Serializable,OptionDataListener,org.zkoss.json.JSONAware
- Direct Known Subclasses:
ColorAxis,ParallelAxes
public class YAxis extends XAxis
The Y axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the horizontal axis. In case of multiple axes, the yAxis node is an array of configuration objects.- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description YAxis()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetGridLineInterpolation()Get whether the grid lines should draw as a polygon with straight lines between categories, or as circles.NumbergetGridLineWidth()Returns the width of the grid lines extending the ticks across the plot area.AxisLabelsgetLabels()Returns the axis labels show the number or category for each tick.NumbergetLineWidth()Returns the width of the line marking the axis itself.ColorgetMaxColor()Returns the max color.NumbergetMaxPadding()Returns padding of the max value relative to the length of the axis.ColorgetMinColor()Returns the min color.NumbergetMinPadding()Returns padding of the min value relative to the length of the axis.StackLabelsgetStackLabels()Returns the stack labels show the total value for each bar in a stacked column or bar chart.StackShadowgetStackShadow()Returns the stack labels show the total value for each bar in a stacked column or bar chart.NumbergetStaticScale()Returns the pixel length each Y axis category occupies.List<Stop>getStops()Get the list of stop colors.NumbergetTickPixelInterval()Returns if tickInterval isnullthis option sets the approximate pixel interval of the tick marks.NumbergetTickWidth()Returns the pixel width of the major tick marks.AxisTitlegetTitle()Returns the axis title, showing next to the axis line.StringgetTooltipValueFormat()Parallel coordinates only.booleanisEndOnTick()Returns whether to force the axis to end on a tick.booleanisReversed()Returns whether to reverse the axis so that the highest number is closest to the origin.booleanisReversedStacks()Returns the reversedStacks.booleanisStartOnTick()Returns whether to force the axis to start on a tick.voidonChange(OptionDataEvent event)Sent when the contents of the chart option has changed.voidsetEndOnTick(boolean endOnTick)Sets whether to force the axis to end on a tick.voidsetGridLineInterpolation(String gridLineInterpolation)Set whether the grid lines should draw as a polygon with straight lines between categories, or as circles.voidsetGridLineWidth(Number gridLineWidth)Sets the width of the grid lines extending the ticks across the plot area.voidsetLineWidth(Number lineWidth)Sets the width of the line marking the axis itself.voidsetMaxColor(String color)Sets the the max color.voidsetMaxColor(Color color)Sets the the max color.voidsetMaxColor(LinearGradient color)Sets the the max color.voidsetMaxColor(RadialGradient color)Sets the the max color.voidsetMaxPadding(Number maxPadding)Sets padding of the max value relative to the length of the axis.voidsetMinColor(String color)Sets the min color.voidsetMinColor(Color color)Sets the min color.voidsetMinColor(LinearGradient color)Sets the min color.voidsetMinColor(RadialGradient color)Sets the min color.voidsetMinPadding(Number minPadding)Sets padding of the min value relative to the length of the axis.voidsetReversed(boolean reversed)Sets whether to reverse the axis so that the highest number is closest to the origin.voidsetReversedStacks(boolean reversedStacks)Sets the reversedStacks.voidsetStackLabels(StackLabels stackLabels)Sets the stack labels show the total value for each bar in a stacked column or bar chart.voidsetStackShadow(StackShadow stackShadow)Sets the stack labels show the total value for each bar in a stacked column or bar chart.voidsetStaticScale(Number staticScale)Sets the pixel length each Y axis category occupies, causing the chart to resize.voidsetStops(List<Stop> stops)Solid gauge series only.voidsetStops(Stop... stops)Solid gauge series only.voidsetTickPixelInterval(Number tickPixelInterval)Sets if tickInterval isnullthis option sets the approximate pixel interval of the tick marks.voidsetTickWidth(Number tickWidth)Sets the pixel width of the major tick marks.voidsetTooltipValueFormat(String tooltipValueFormat)Parallel coordinates only.-
Methods inherited from class org.zkoss.chart.XAxis
getBreaks, getCrosshair, getHeight, getLeft, getLineColor, getTop, getWidth, isShowEmpty, setBreaks, setCrosshair, setCrosshair, setHeight, setLeft, setLeft, setLineColor, setLineColor, setLineColor, setLineColor, setShowEmpty, setTop, setTop, setWidth
-
Methods inherited from class org.zkoss.chart.Axis
addPlotBand, addPlotLine, getAccessibility, getAlternateGridColor, getAngle, getCategories, getCeiling, getClassName, getCrossing, getDateTimeLabelFormats, getFloor, getGridLineColor, getGridLineDashStyle, getGridZIndex, getId, getLinkedTo, getMargin, getMax, getMin, getMinorGridLineColor, getMinorGridLineDashStyle, getMinorGridLineWidth, getMinorTickColor, getMinorTickInterval, getMinorTickLength, getMinorTickPosition, getMinorTicksPerMajor, getMinorTickWidth, getMinRange, getMinTickInterval, getOffset, getPane, getPlotBands, getPlotLines, getSoftMax, getSoftMin, getStartOfWeek, getTickAmount, getTickColor, getTickInterval, getTickLength, getTickmarkPlacement, getTickPosition, getTickPositions, getType, getZIndex, isAlignTicks, isAllowDecimals, isAllowNegativeLog, isMinorTicks, isOpposite, isPanningEnabled, isShowFirstLabel, isShowLastLabel, isUniqueNames, isVisible, isZoomEnabled, remove, removePlotBand, removePlotBand, removePlotLine, removePlotLine, setAccessibility, setAlignTicks, setAllowDecimals, setAllowNegativeLog, setAlternateGridColor, setAlternateGridColor, setAlternateGridColor, setAlternateGridColor, setAngle, setCategories, setCategories, setCeiling, setClassName, setCrossing, setDateTimeLabelFormats, setExtremes, setExtremes, setFloor, setGridLineColor, setGridLineColor, setGridLineColor, setGridLineColor, setGridLineDashStyle, setGridZIndex, setId, setLabels, setLinkedTo, setMargin, setMax, setMin, setMinorGridLineColor, setMinorGridLineColor, setMinorGridLineColor, setMinorGridLineColor, setMinorGridLineDashStyle, setMinorGridLineWidth, setMinorTickColor, setMinorTickColor, setMinorTickColor, setMinorTickColor, setMinorTickInterval, setMinorTickInterval, setMinorTickLength, setMinorTickPosition, setMinorTicks, setMinorTicksPerMajor, setMinorTickWidth, setMinRange, setMinTickInterval, setOffset, setOpposite, setPane, setPanningEnabled, setPlotBands, setPlotBands, setPlotLines, setPlotLines, setShowFirstLabel, setShowLastLabel, setSoftMax, setSoftMin, setStartOfWeek, setStartOnTick, setTickAmount, setTickColor, setTickInterval, setTickLength, setTickmarkPlacement, setTickPosition, setTickPositions, setTitle, setTitle, setType, setUniqueNames, setVisible, setZIndex, setZoomEnabled
-
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
-
getStackLabels
public StackLabels getStackLabels()
Returns the stack labels show the total value for each bar in a stacked column or bar chart. The label will be placed on top of positive columns and below negative columns. In case of an inverted column chart or a bar chart the label is placed to the right of positive bars and to the left of negative bars.
-
setStackLabels
public void setStackLabels(StackLabels stackLabels)
Sets the stack labels show the total value for each bar in a stacked column or bar chart. The label will be placed on top of positive columns and below negative columns. In case of an inverted column chart or a bar chart the label is placed to the right of positive bars and to the left of negative bars.
-
getStackShadow
public StackShadow getStackShadow()
Returns the stack labels show the total value for each bar in a stacked column or bar chart. The label will be placed on top of positive columns and below negative columns. In case of an inverted column chart or a bar chart the label is placed to the right of positive bars and to the left of negative bars.- Since:
- 11.2.0.0
-
setStackShadow
public void setStackShadow(StackShadow stackShadow)
Sets the stack labels show the total value for each bar in a stacked column or bar chart. The label will be placed on top of positive columns and below negative columns. In case of an inverted column chart or a bar chart the label is placed to the right of positive bars and to the left of negative bars.- Since:
- 11.2.0.0
-
isEndOnTick
public boolean isEndOnTick()
Returns whether to force the axis to end on a tick. Use this option with thesetMaxPadding(Number)option to control the axis end.Default: true.
- Overrides:
isEndOnTickin classAxis- 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 thesetMaxPadding(Number)option to control the axis end.Default: true.
- Overrides:
setEndOnTickin classAxis- Parameters:
endOnTick- whether to force the axis to end on a tick
-
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: true.
- Overrides:
isStartOnTickin classAxis
-
getTickWidth
public Number getTickWidth()
Returns the pixel width of the major tick marks.Default: 0.
- Overrides:
getTickWidthin classAxis
-
setTickWidth
public void setTickWidth(Number tickWidth)
Sets the pixel width of the major tick marks.- Overrides:
setTickWidthin classAxis
-
getTooltipValueFormat
public String getTooltipValueFormat()
Parallel coordinates only. Returns a format that will be used for point.y and available in tooltip.pointFormat as {point.formattedValue}. If not set, {point.formattedValue} will use other options, in this order:- yAxis.labels.format will be used if set
- If yAxis is a category, then category name will be displayed
- If yAxis is a datetime, then value will use the same format as yAxis labels
- If yAxis is linear/logarithmic type, then simple value will be used
Default: null
- Since:
- 7.2.1.0
-
setTooltipValueFormat
public void setTooltipValueFormat(String tooltipValueFormat)
Parallel coordinates only. Sets a format that will be used for point.y and available in tooltip.pointFormat as {point.formattedValue}. If not set, {point.formattedValue} will use other options, in this order:- yAxis.labels.format will be used if set
- If yAxis is a category, then category name will be displayed
- If yAxis is a datetime, then value will use the same format as yAxis labels
- If yAxis is linear/logarithmic type, then simple value will be used
- Since:
- 7.2.1.0
-
getMaxColor
public Color getMaxColor()
Returns the max color. Solid gauge only. Unless stops are set, the color to represent the maximum value of the Y axis.Default: #102D4C.
-
setMaxColor
public void setMaxColor(Color color)
Sets the the max color. Solid gauge only. Unless stops are set, the color to represent the maximum value of the Y axis.
-
setMaxColor
public void setMaxColor(String color)
Sets the the max color. Solid gauge only. Unless stops are set, the color to represent the maximum value of the Y axis.
-
setMaxColor
public void setMaxColor(LinearGradient color)
Sets the the max color. Solid gauge only. Unless stops are set, the color to represent the maximum value of the Y axis.
-
setMaxColor
public void setMaxColor(RadialGradient color)
Sets the the max color. Solid gauge only. Unless stops are set, the color to represent the maximum value of the Y axis.
-
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 theAxis.setMax(Number)option is set or a max extreme is set usingAxis.setExtremes(Number, Number), the maxPadding will be ignored.Default: 0.05.
- Overrides:
getMaxPaddingin classAxis
-
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 theAxis.setMax(Number)option is set or a max extreme is set usingAxis.setExtremes(Number, Number), the maxPadding will be ignored.- Overrides:
setMaxPaddingin classAxis
-
getMinColor
public Color getMinColor()
Returns the min color. Solid gauge only. Unless stops are set, the color to represent the minimum value of the Y axis.Default: #EFEFFF.
-
setMinColor
public void setMinColor(Color color)
Sets the min color. Solid gauge only. Unless stops are set, the color to represent the minimum value of the Y axis.
-
setMinColor
public void setMinColor(String color)
Sets the min color. Solid gauge only. Unless stops are set, the color to represent the minimum value of the Y axis.
-
setMinColor
public void setMinColor(LinearGradient color)
Sets the min color. Solid gauge only. Unless stops are set, the color to represent the minimum value of the Y axis.
-
setMinColor
public void setMinColor(RadialGradient color)
Sets the min color. Solid gauge only. Unless stops are set, the color to represent the minimum value of the Y axis.
-
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 theAxis.setMin(Number)option is set or a min extreme is set usingAxis.setExtremes(Number, Number), the minPadding will be ignored.Default: 0.05.
- Overrides:
getMinPaddingin classAxis
-
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 theAxis.setMin(Number)option is set or a min extreme is set usingAxis.setExtremes(Number, Number), the minPadding will be ignored.- Overrides:
setMinPaddingin classAxis
-
isReversed
public boolean isReversed()
Returns whether to reverse the axis so that the highest number is closest to the origin.Default: false.
- Overrides:
isReversedin classAxis- Since:
- 11.2.0.0
-
setReversed
public void setReversed(boolean reversed)
Sets whether to reverse the axis so that the highest number is closest to the origin.Default: false.
- Overrides:
setReversedin classAxis- Since:
- 11.2.0.0
-
isReversedStacks
public boolean isReversedStacks()
Returns the reversedStacks. If true, the first series in a stack will be drawn on top in a positive, non-reversed Y axis. If false, the first series is in the base of the stack.Default: true.
- Overrides:
isReversedStacksin classAxis
-
setReversedStacks
public void setReversedStacks(boolean reversedStacks)
Sets the reversedStacks. If true, the first series in a stack will be drawn on top in a positive, non-reversed Y axis. If false, the first series is in the base of the stack.Default: true.
- Overrides:
setReversedStacksin classAxis
-
getStops
public List<Stop> getStops()
Get the list of stop colors.Default: null
- Returns:
- list of stop colors
- See Also:
Stop
-
setStops
public void setStops(List<Stop> stops)
Solid gauge series only. Color stops for the solid gauge.- Parameters:
stops- a list of stop colors- See Also:
Stop
-
setStops
public void setStops(Stop... stops)
Solid gauge series only. Color stops for the solid gauge.- Parameters:
stops- an array of stop colors- See Also:
Stop
-
getGridLineWidth
public Number getGridLineWidth()
Returns the width of the grid lines extending the ticks across the plot area.Default: 1.
- Overrides:
getGridLineWidthin classAxis
-
setGridLineWidth
public void setGridLineWidth(Number gridLineWidth)
Sets the width of the grid lines extending the ticks across the plot area.- Overrides:
setGridLineWidthin classAxis
-
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: 72.
- Overrides:
getTickPixelIntervalin classAxis
-
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: 72.
- Overrides:
setTickPixelIntervalin classAxis
-
getLabels
public AxisLabels getLabels()
Returns the axis labels show the number or category for each tick.Default:
labels: { x: -8, y: 3 }
-
getLineWidth
public Number getLineWidth()
Returns the width of the line marking the axis itself.Default: 0.
- Overrides:
getLineWidthin classXAxis
-
setLineWidth
public void setLineWidth(Number lineWidth)
Sets the width of the line marking the axis itself.- Overrides:
setLineWidthin classXAxis
-
getTitle
public AxisTitle getTitle()
Returns the axis title, showing next to the axis line.Default: an instance of
AxisTitle.
-
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 classAxis
-
getStaticScale
public Number getStaticScale()
Returns the pixel length each Y axis category occupies. Setting this value makes the chart resize itself.Default: 50
- Since:
- 12.5.0.0
-
setStaticScale
public void setStaticScale(Number staticScale)
Sets the pixel length each Y axis category occupies, causing the chart to resize.- Since:
- 12.5.0.0
-
getGridLineInterpolation
public String getGridLineInterpolation()
Get whether the grid lines should draw as a polygon with straight lines between categories, or as circles. Can be either circle or polygon.Defaults to null.
- Since:
- 2.1.0
-
setGridLineInterpolation
public void setGridLineInterpolation(String gridLineInterpolation)
Set whether the grid lines should draw as a polygon with straight lines between categories, or as circles. Can be either circle or polygon.- Parameters:
gridLineInterpolation-- Since:
- 2.1.0
-
-