org.jfree.chart.axis
Class VerticalSymbolicAxis

java.lang.Object
  |
  +--org.jfree.chart.axis.Axis
        |
        +--org.jfree.chart.axis.ValueAxis
              |
              +--org.jfree.chart.axis.NumberAxis
                    |
                    +--org.jfree.chart.axis.VerticalNumberAxis
                          |
                          +--org.jfree.chart.axis.VerticalSymbolicAxis
All Implemented Interfaces:
AxisConstants, java.io.Serializable, VerticalAxis

public class VerticalSymbolicAxis
extends VerticalNumberAxis
implements VerticalAxis, java.io.Serializable

A standard linear value axis, for SYMBOLIC values displayed vertically.

Author:
Anthony Boulestreau
See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_SYMBOLIC_GRID_LINE_PAINT
          The default symbolic grid line paint.
 
Fields inherited from class org.jfree.chart.axis.VerticalNumberAxis
DEFAULT_VERTICAL_LABEL
 
Fields inherited from class org.jfree.chart.axis.NumberAxis
DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT
 
Fields 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_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT
 
Fields inherited from interface org.jfree.chart.axis.AxisConstants
BOTTOM, DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, 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, LEFT, RIGHT, TOP
 
Constructor Summary
VerticalSymbolicAxis(java.lang.String label, java.lang.String[] sv)
          Constructs a vertical symbolic axis, using default attribute values where necessary.
 
Method Summary
protected  void autoAdjustRange()
          Rescales the axis to ensure that all data is visible.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea, int location)
          Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 void drawSymbolicGridLines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea)
          Draws the symbolic grid lines.
 void drawSymbolicGridLines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea, boolean firstGridLineIsDark)
          Draws the symbolic grid lines.
 java.awt.geom.Rectangle2D.Double getSymbolicGridLine(int position)
          Get the symbolic grid line corresponding to the specified position.
 java.awt.Paint getSymbolicGridPaint()
          Returns the symbolic grid line color.
 java.lang.String[] getSymbolicValue()
          Returns the list of the symbolic values to display.
 boolean isGridLinesVisible()
          Returns true if the symbolic grid lines are showing, and false otherwise.
 void refreshTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, int location)
          Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
protected  void selectAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea)
          This operation is not supported by the symbolic values
 void setAnchoredRange(double range)
          Redefinition of setAnchoredRange for the symbolicvalues.
 void setSymbolicGridLinesVisible(boolean flag)
          Sets the visibility of the symbolic grid lines and notifies registered listeners that the axis has been modified.
 java.lang.String valueToString(double value)
          Converts a value to a string, using the list of symbolic values.
 
Methods inherited from class org.jfree.chart.axis.VerticalNumberAxis
configure, isCompatiblePlot, isVerticalLabel, reserveWidth, reserveWidth, setVerticalLabel, translateJava2DtoValue, translateValueToJava2D
 
Methods inherited from class org.jfree.chart.axis.NumberAxis
autoRangeIncludesZero, autoRangeStickyZero, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, getNumberFormatOverride, getTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setNumberFormatOverride, setTickUnit, setTickUnit
 
Methods inherited from class org.jfree.chart.axis.ValueAxis
centerRange, getAnchorValue, getAutoRangeMinimumSize, getAutoTickIndex, getFixedAutoRange, getLowerMargin, getMaximumAxisValue, getMinimumAxisValue, getRange, getStandardTickUnits, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, resizeRange, resizeRange, setAnchorValue, setAnchorValueAttribute, setAutoRange, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setFixedAutoRange, setInverted, setLowerMargin, setMaximumAxisValue, setMinimumAxisValue, setRange, setRange, setRangeAboutValue, setRangeAttribute, setStandardTickUnits, setUpperMargin
 
Methods inherited from class org.jfree.chart.axis.Axis
addChangeListener, drawHorizontalLabel, drawVerticalLabel, equals, getFixedDimension, getLabel, getLabelFont, getLabelInsets, getLabelPaint, getMaxTickLabelWidth, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, getTicks, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, removeChangeListener, setFixedDimension, setLabel, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.chart.axis.VerticalAxis
reserveWidth, reserveWidth
 

Field Detail

DEFAULT_SYMBOLIC_GRID_LINE_PAINT

public static final java.awt.Paint DEFAULT_SYMBOLIC_GRID_LINE_PAINT
The default symbolic grid line paint.

Constructor Detail

VerticalSymbolicAxis

public VerticalSymbolicAxis(java.lang.String label,
                            java.lang.String[] sv)
Constructs a vertical symbolic axis, using default attribute values where necessary.

Parameters:
label - the axis label (null permitted).
sv - the list of symbolic value to display instead of the numeric value.
Method Detail

getSymbolicValue

public java.lang.String[] getSymbolicValue()
Returns the list of the symbolic values to display.

Returns:
list of symbolic values.

getSymbolicGridPaint

public java.awt.Paint getSymbolicGridPaint()
Returns the symbolic grid line color.

Returns:
the grid line color.

isGridLinesVisible

public boolean isGridLinesVisible()
Returns true if the symbolic grid lines are showing, and false otherwise.

Returns:
true if the symbolic grid lines are showing.

setSymbolicGridLinesVisible

public void setSymbolicGridLinesVisible(boolean flag)
Sets the visibility of the symbolic grid lines and notifies registered listeners that the axis has been modified.

Parameters:
flag - the new setting.

valueToString

public java.lang.String valueToString(double value)
Converts a value to a string, using the list of symbolic values.

Parameters:
value - value to convert.
Returns:
the symbolic value.

refreshTicks

public void refreshTicks(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D plotArea,
                         java.awt.geom.Rectangle2D dataArea,
                         int location)
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).

Overrides:
refreshTicks in class VerticalNumberAxis
Parameters:
g2 - the graphics device.
plotArea - the area in which the plot and the axes should be drawn.
dataArea - the area in which the plot should be drawn.
location - the location of the axis.

setAnchoredRange

public void setAnchoredRange(double range)
Redefinition of setAnchoredRange for the symbolicvalues.

Overrides:
setAnchoredRange in class ValueAxis
Parameters:
range - the new range.

selectAutoTickUnit

protected void selectAutoTickUnit(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D drawArea,
                                  java.awt.geom.Rectangle2D plotArea)
This operation is not supported by the symbolic values

Overrides:
selectAutoTickUnit in class VerticalNumberAxis
Parameters:
g2 - the graphics device.
drawArea - the area in which the plot and axes should be drawn.
plotArea - the area in which the plot should be drawn.

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D drawArea,
                 java.awt.geom.Rectangle2D plotArea,
                 int location)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).

Overrides:
draw in class VerticalNumberAxis
Parameters:
g2 - the graphics device.
drawArea - the area within which the chart should be drawn.
plotArea - the area within which the plot should be drawn (a subset of the drawArea).
location - the axis location.

drawSymbolicGridLines

public void drawSymbolicGridLines(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D drawArea,
                                  java.awt.geom.Rectangle2D plotArea)
Draws the symbolic grid lines.

The colors are consecutively the color specified by symbolicGridPaint (DEFAULT_SYMBOLIC_GRID_LINE_PAINT by default) and white.

Parameters:
g2 - the graphics device.
drawArea - the area within which the chart should be drawn.
plotArea - the area within which the plot should be drawn (a subset of the drawArea).

drawSymbolicGridLines

public void drawSymbolicGridLines(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D drawArea,
                                  java.awt.geom.Rectangle2D plotArea,
                                  boolean firstGridLineIsDark)
Draws the symbolic grid lines.

The colors are consecutively the color specified by symbolicGridPaint (DEFAULT_SYMBOLIC_GRID_LINE_PAINT by default) and white. or if firstGridLineIsDark is true white and the color specified by symbolicGridPaint.

Parameters:
g2 - the graphics device.
drawArea - the area within which the chart should be drawn.
plotArea - the area within which the plot should be drawn (a subset of the drawArea).
firstGridLineIsDark - True: the first symbolic grid line take the color of symbolicGridPaint. False: the first symbolic grid line is white.

getSymbolicGridLine

public java.awt.geom.Rectangle2D.Double getSymbolicGridLine(int position)
Get the symbolic grid line corresponding to the specified position.

Parameters:
position - position of the grid line, startinf from 0.
Returns:
the symbolic grid line corresponding to the specified position.

autoAdjustRange

protected void autoAdjustRange()
Rescales the axis to ensure that all data is visible.

Overrides:
autoAdjustRange in class VerticalNumberAxis