Package org.jfree.chart.axis
Class SymbolAxis
java.lang.Object
org.jfree.chart.axis.Axis
org.jfree.chart.axis.ValueAxis
org.jfree.chart.axis.NumberAxis
org.jfree.chart.axis.SymbolAxis
- All Implemented Interfaces:
Serializable,Cloneable,PublicCloneable
A standard linear value axis that replaces integer values with symbols.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PaintThe default paint for alternate grid bands.static final PaintThe default grid band paint.Fields inherited from class org.jfree.chart.axis.NumberAxis
DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT, DEFAULT_VERTICAL_TICK_LABELSFields inherited from class org.jfree.chart.axis.ValueAxis
DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_AUTO_TICK_UNIT_SELECTION, DEFAULT_INVERTED, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNTFields inherited from class org.jfree.chart.axis.Axis
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE -
Constructor Summary
ConstructorsConstructorDescriptionSymbolAxis(String label, String[] sv) Constructs a symbol axis, using default attribute values where necessary. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRescales the axis to ensure that all data is visible.draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo plotState) Draws the axis on a Java 2D graphics device (such as the screen or a printer).protected voiddrawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) Draws the grid bands (alternate bands are colored usinggetGridBandPaint()andgetGridBandAlternatePaint().protected voiddrawGridBandsHorizontal(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, boolean firstGridBandIsDark, List ticks) Draws the grid bands for the axis when it is at the top or bottom of the plot.protected voiddrawGridBandsVertical(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, boolean firstGridBandIsDark, List ticks) Draws the grid bands for an axis that is aligned to the left or right of the data area (that is, a vertical axis).booleanTests this axis for equality with an arbitrary object.Returns the second paint used to color grid bands (two colors are used alternately, the other is returned bygetGridBandPaint()).Returns the paint used to color grid bands (two colors are used alternately, the other is returned bygetGridBandAlternatePaint()).String[]Returns an array of the symbols for the axis.booleanReturns the flag that controls whether or not grid bands are drawn for the axis.refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).protected ListrefreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).protected ListrefreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).protected voidselectAutoTickUnit(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) This operation is not supported by this axis.voidsetGridBandAlternatePaint(Paint paint) Sets the grid band paint and notifies registered listeners that the axis has been changed.voidsetGridBandPaint(Paint paint) Sets the grid band paint and notifies registered listeners that the axis has been changed.voidsetGridBandsVisible(boolean flag) Sets the flag that controls whether or not grid bands are drawn for this axis and notifies registered listeners that the axis has been modified.valueToString(double value) Converts a value to a string, using the list of symbols.Methods inherited from class org.jfree.chart.axis.NumberAxis
calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, estimateMaximumTickLabelHeight, estimateMaximumTickLabelWidth, getAutoRangeIncludesZero, getAutoRangeStickyZero, getMarkerBand, getNumberFormatOverride, getRangeType, getTickUnit, hashCode, java2DToValue, selectHorizontalAutoTickUnit, selectVerticalAutoTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setRangeType, setTickUnit, setTickUnit, valueToJava2DMethods inherited from class org.jfree.chart.axis.ValueAxis
calculateAnchorPoint, centerRange, drawAxisLine, drawTickMarksAndLabels, findMaximumTickLabelHeight, findMaximumTickLabelWidth, getAutoRangeMinimumSize, getAutoTickIndex, getDefaultAutoRange, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getMinorTickCount, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, lengthToJava2D, pan, reserveSpace, resizeRange, resizeRange, resizeRange2, setAutoRange, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMinorTickCount, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels, zoomRangeMethods inherited from class org.jfree.chart.axis.Axis
addChangeListener, createAndAddEntity, createAttributedLabel, drawAttributedLabel, drawLabel, fireChangeEvent, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, labelAnchorH, labelAnchorV, labelLocationX, labelLocationY, notifyListeners, removeChangeListener, setAttributedLabel, setAttributedLabel, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelLocation, setLabelPaint, setMinorTickMarkInsideLength, setMinorTickMarkOutsideLength, setMinorTickMarksVisible, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
-
Field Details
-
DEFAULT_GRID_BAND_PAINT
The default grid band paint. -
DEFAULT_GRID_BAND_ALTERNATE_PAINT
The default paint for alternate grid bands.
-
-
Constructor Details
-
SymbolAxis
Constructs a symbol axis, using default attribute values where necessary.- Parameters:
label- the axis label (nullpermitted).sv- the list of symbols to display instead of the numeric values.
-
-
Method Details
-
getSymbols
Returns an array of the symbols for the axis.- Returns:
- The symbols.
-
isGridBandsVisible
Returns the flag that controls whether or not grid bands are drawn for the axis. The default value istrue.- Returns:
- A boolean.
- See Also:
-
setGridBandsVisible
Sets the flag that controls whether or not grid bands are drawn for this axis and notifies registered listeners that the axis has been modified. Each band is the area between two adjacent gridlines running perpendicular to the axis. When the bands are drawn they are filled with the colorsgetGridBandPaint()andgetGridBandAlternatePaint()in an alternating sequence.- Parameters:
flag- the new setting.- See Also:
-
getGridBandPaint
Returns the paint used to color grid bands (two colors are used alternately, the other is returned bygetGridBandAlternatePaint()). The default value isDEFAULT_GRID_BAND_PAINT.- Returns:
- The paint (never
null). - See Also:
-
setGridBandPaint
Sets the grid band paint and notifies registered listeners that the axis has been changed. See thesetGridBandsVisible(boolean)method for more information about grid bands.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
getGridBandAlternatePaint
Returns the second paint used to color grid bands (two colors are used alternately, the other is returned bygetGridBandPaint()). The default value isDEFAULT_GRID_BAND_ALTERNATE_PAINT(transparent).- Returns:
- The paint (never
null). - See Also:
-
setGridBandAlternatePaint
Sets the grid band paint and notifies registered listeners that the axis has been changed. See thesetGridBandsVisible(boolean)method for more information about grid bands.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
selectAutoTickUnit
This operation is not supported by this axis.- Overrides:
selectAutoTickUnitin classNumberAxis- Parameters:
g2- the graphics device.dataArea- the area in which the plot and axes should be drawn.edge- the edge along which the axis is drawn.
-
draw
public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo plotState) Draws the axis on a Java 2D graphics device (such as the screen or a printer).- Overrides:
drawin classNumberAxis- Parameters:
g2- the graphics device (nullnot permitted).cursor- the cursor location.plotArea- the area within which the plot and axes should be drawn (nullnot permitted).dataArea- the area within which the data should be drawn (nullnot permitted).edge- the axis location (nullnot permitted).plotState- collects information about the plot (nullpermitted).- Returns:
- The axis state (never
null).
-
drawGridBands
protected void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) Draws the grid bands (alternate bands are colored usinggetGridBandPaint()andgetGridBandAlternatePaint().- Parameters:
g2- the graphics target (nullnot permitted).plotArea- the area within which the plot is drawn (nullnot permitted).dataArea- the data area to which the axes are aligned (nullnot permitted).edge- the edge to which the axis is aligned (nullnot permitted).ticks- the ticks (nullnot permitted).
-
drawGridBandsHorizontal
protected void drawGridBandsHorizontal(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, boolean firstGridBandIsDark, List ticks) Draws the grid bands for the axis when it is at the top or bottom of the plot.- Parameters:
g2- the graphics target (nullnot permitted).plotArea- the area within which the plot is drawn (not used here).dataArea- the area for the data (to which the axes are aligned,nullnot permitted).firstGridBandIsDark- True: the first grid band takes the color ofgridBandPaint. False: the second grid band takes the color ofgridBandPaint.ticks- a list of ticks (nullnot permitted).
-
drawGridBandsVertical
protected void drawGridBandsVertical(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, boolean firstGridBandIsDark, List ticks) Draws the grid bands for an axis that is aligned to the left or right of the data area (that is, a vertical axis).- Parameters:
g2- the graphics target (nullnot permitted).plotArea- the area within which the plot is drawn (not used here).dataArea- the area for the data (to which the axes are aligned,nullnot permitted).firstGridBandIsDark- True: the first grid band takes the color ofgridBandPaint. False: the second grid band takes the color ofgridBandPaint.ticks- a list of ticks (nullnot permitted).
-
autoAdjustRange
Rescales the axis to ensure that all data is visible.- Overrides:
autoAdjustRangein classNumberAxis
-
refreshTicks
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Overrides:
refreshTicksin classNumberAxis- Parameters:
g2- the graphics device.state- the axis state.dataArea- the area in which the data should be drawn.edge- the location of the axis.- Returns:
- A list of ticks.
-
refreshTicksHorizontal
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Overrides:
refreshTicksHorizontalin classNumberAxis- Parameters:
g2- the graphics device.dataArea- the area in which the data should be drawn.edge- the location of the axis.- Returns:
- The ticks.
-
refreshTicksVertical
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Overrides:
refreshTicksVerticalin classNumberAxis- Parameters:
g2- the graphics device.dataArea- the area in which the plot should be drawn.edge- the location of the axis.- Returns:
- The ticks.
-
valueToString
Converts a value to a string, using the list of symbols.- Parameters:
value- value to convert.- Returns:
- The symbol.
-
equals
Tests this axis for equality with an arbitrary object.- Overrides:
equalsin classNumberAxis- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-