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 String
getGridLineInterpolation()
Get whether the grid lines should draw as a polygon with straight lines between categories, or as circles.Number
getGridLineWidth()
Returns the width of the grid lines extending the ticks across the plot area.AxisLabels
getLabels()
Returns the axis labels show the number or category for each tick.Number
getLineWidth()
Returns the width of the line marking the axis itself.Color
getMaxColor()
Returns the max color.Number
getMaxPadding()
Returns padding of the max value relative to the length of the axis.Color
getMinColor()
Returns the min color.Number
getMinPadding()
Returns padding of the min value relative to the length of the axis.StackLabels
getStackLabels()
Returns the stack labels show the total value for each bar in a stacked column or bar chart.StackShadow
getStackShadow()
Returns the stack labels show the total value for each bar in a stacked column or bar chart.List<Stop>
getStops()
Get the list of stop colors.Number
getTickPixelInterval()
Returns if tickInterval isnull
this option sets the approximate pixel interval of the tick marks.Number
getTickWidth()
Returns the pixel width of the major tick marks.AxisTitle
getTitle()
Returns the axis title, showing next to the axis line.String
getTooltipValueFormat()
Parallel coordinates only.boolean
isEndOnTick()
Returns whether to force the axis to end on a tick.boolean
isReversed()
Returns whether to reverse the axis so that the highest number is closest to the origin.boolean
isReversedStacks()
Returns the reversedStacks.boolean
isStartOnTick()
Returns whether to force the axis to start on a tick.void
onChange(OptionDataEvent event)
Sent when the contents of the chart option has changed.void
setEndOnTick(boolean endOnTick)
Sets whether to force the axis to end on a tick.void
setGridLineInterpolation(String gridLineInterpolation)
Set whether the grid lines should draw as a polygon with straight lines between categories, or as circles.void
setGridLineWidth(Number gridLineWidth)
Sets the width of the grid lines extending the ticks across the plot area.void
setLineWidth(Number lineWidth)
Sets the width of the line marking the axis itself.void
setMaxColor(String color)
Sets the the max color.void
setMaxColor(Color color)
Sets the the max color.void
setMaxColor(LinearGradient color)
Sets the the max color.void
setMaxColor(RadialGradient color)
Sets the the max color.void
setMaxPadding(Number maxPadding)
Sets padding of the max value relative to the length of the axis.void
setMinColor(String color)
Sets the min color.void
setMinColor(Color color)
Sets the min color.void
setMinColor(LinearGradient color)
Sets the min color.void
setMinColor(RadialGradient color)
Sets the min color.void
setMinPadding(Number minPadding)
Sets padding of the min value relative to the length of the axis.void
setReversed(boolean reversed)
Sets whether to reverse the axis so that the highest number is closest to the origin.void
setReversedStacks(boolean reversedStacks)
Sets the reversedStacks.void
setStackLabels(StackLabels stackLabels)
Sets the stack labels show the total value for each bar in a stacked column or bar chart.void
setStackShadow(StackShadow stackShadow)
Sets the stack labels show the total value for each bar in a stacked column or bar chart.void
setStops(List<Stop> stops)
Solid gauge series only.void
setStops(Stop... stops)
Solid gauge series only.void
setTickPixelInterval(Number tickPixelInterval)
Sets if tickInterval isnull
this option sets the approximate pixel interval of the tick marks.void
setTickWidth(Number tickWidth)
Sets the pixel width of the major tick marks.void
setTooltipValueFormat(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:
isEndOnTick
in 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:
setEndOnTick
in 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 themaxPadding
option to control the axis start.Default: true.
- Overrides:
isStartOnTick
in classAxis
-
getTickWidth
public Number getTickWidth()
Returns the pixel width of the major tick marks.Default: 0.
- Overrides:
getTickWidth
in classAxis
-
setTickWidth
public void setTickWidth(Number tickWidth)
Sets the pixel width of the major tick marks.- Overrides:
setTickWidth
in 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:
getMaxPadding
in 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:
setMaxPadding
in 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:
getMinPadding
in 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:
setMinPadding
in classAxis
-
isReversed
public boolean isReversed()
Returns whether to reverse the axis so that the highest number is closest to the origin.Default: false.
- Overrides:
isReversed
in 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:
setReversed
in 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:
isReversedStacks
in 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:
setReversedStacks
in 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:
getGridLineWidth
in classAxis
-
setGridLineWidth
public void setGridLineWidth(Number gridLineWidth)
Sets the width of the grid lines extending the ticks across the plot area.- Overrides:
setGridLineWidth
in classAxis
-
getTickPixelInterval
public Number getTickPixelInterval()
Returns if tickInterval isnull
this option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to72
for the Y axis and100
for the X axis.Default: 72.
- Overrides:
getTickPixelInterval
in classAxis
-
setTickPixelInterval
public void setTickPixelInterval(Number tickPixelInterval)
Sets if tickInterval isnull
this option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to72
for the Y axis and100
for the X axis.Default: 72.
- Overrides:
setTickPixelInterval
in 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:
getLineWidth
in classXAxis
-
setLineWidth
public void setLineWidth(Number lineWidth)
Sets the width of the line marking the axis itself.- Overrides:
setLineWidth
in 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:OptionDataListener
Sent when the contents of the chart option has changed.- Specified by:
onChange
in interfaceOptionDataListener
- Overrides:
onChange
in classAxis
-
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
-
-