com.jrefinery.chart
Class HorizontalSymbolicAxis

java.lang.Object
  extended by com.jrefinery.chart.Axis
      extended by com.jrefinery.chart.ValueAxis
          extended by com.jrefinery.chart.NumberAxis
              extended by com.jrefinery.chart.HorizontalNumberAxis
                  extended by com.jrefinery.chart.HorizontalSymbolicAxis
All Implemented Interfaces:
AxisConstants, HorizontalAxis

public class HorizontalSymbolicAxis
extends HorizontalNumberAxis
implements HorizontalAxis

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


Field Summary
static java.awt.Paint DEFAULT_SYMBOLIC_GRID_LINE_PAINT
          The default symbolic grid line paint.
 java.util.List symbolicGridLineList
          List of the symbolic grid lines shapes
protected  boolean symbolicGridLinesVisible
          Flag that indicates whether or not symbolic grid lines are visible.
protected  java.awt.Paint symbolicGridPaint
          Color of the dark part of the symbolic grid line
protected  java.util.List symbolicValue
          The list of symbolic value to display instead of the numeric values
protected  boolean xSymbolicZoomIsAccepted
          Enable or not the zoom
 
Fields inherited from class com.jrefinery.chart.HorizontalNumberAxis
verticalTickLabels
 
Fields inherited from class com.jrefinery.chart.NumberAxis
autoRangeIncludesZero, autoRangeMinimumSize, autoRangeStickyZero, DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_LOWER_MARGIN, DEFAULT_MINIMUM_AUTO_RANGE, DEFAULT_TICK_UNIT, DEFAULT_UPPER_MARGIN, inverted, lowerMargin, standardTickUnits, tickUnit, upperMargin
 
Fields inherited from class com.jrefinery.chart.ValueAxis
anchorValue, autoRange, autoTickIndex, autoTickUnitSelection, crosshairLockedOnData, crosshairPaint, crosshairStroke, crosshairValue, crosshairVisible, DEFAULT_AUTO_RANGE, DEFAULT_CROSSHAIR_PAINT, DEFAULT_CROSSHAIR_STROKE, DEFAULT_CROSSHAIR_VISIBLE, DEFAULT_GRID_LINE_PAINT, DEFAULT_GRID_LINE_STROKE, DEFAULT_MAXIMUM_AXIS_VALUE, DEFAULT_MINIMUM_AXIS_VALUE, fixedAutoRange, gridLinesVisible, gridPaint, gridStroke, maximumRangeLength, minimumRangeLength, range
 
Fields inherited from class com.jrefinery.chart.Axis
fixedDimension, label, labelFont, labelInsets, labelPaint, listeners, plot, tickLabelFont, tickLabelInsets, tickLabelPaint, tickLabelsVisible, tickMarkStroke, tickMarksVisible, ticks, visible
 
Fields inherited from interface com.jrefinery.chart.AxisConstants
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_STROKE
 
Constructor Summary
HorizontalSymbolicAxis(java.lang.String label, java.lang.String[] sv)
          Constructs a vertical symbolic axis, using default values where necessary.
HorizontalSymbolicAxis(java.lang.String label, java.lang.String[] sv, java.awt.Font labelFont, boolean symbolicGridLinesVisible, java.awt.Paint symbolicGridPaint)
          Constructs a horizontal symbolic axis.
HorizontalSymbolicAxis(java.lang.String label, java.lang.String[] sv, java.awt.Font labelFont, java.awt.Paint labelPaint, java.awt.Insets labelInsets, boolean tickLabelsVisible, java.awt.Font tickLabelFont, java.awt.Paint tickLabelPaint, java.awt.Insets tickLabelInsets, boolean verticalTickLabels, boolean tickMarksVisible, java.awt.Stroke tickMarkStroke, boolean autoRange, boolean autoRangeIncludesZero, boolean autoRangeStickyZero, java.lang.Number autoRangeMinimum, double minimumAxisValue, double maximumAxisValue, boolean inverted, boolean autoTickUnitSelection, NumberTickUnit tickUnit, boolean gridLinesVisible, java.awt.Stroke gridStroke, java.awt.Paint gridPaint, boolean crosshairVisible, double crosshairValue, java.awt.Stroke crosshairStroke, java.awt.Paint crosshairPaint, boolean symbolicGridLinesVisible, java.awt.Paint symbolicGridPaint)
          Constructs a new horizontal symbolic axis.
 
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)
          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 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 com.jrefinery.chart.HorizontalNumberAxis
configure, getVerticalTickLabels, isCompatiblePlot, refreshTicks, reserveAxisArea, reserveHeight, setVerticalTickLabels, translateJava2DtoValue, translateValueToJava2D
 
Methods inherited from class com.jrefinery.chart.NumberAxis
autoRangeIncludesZero, autoRangeStickyZero, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, getAutoRangeMinimumSize, getLowerMargin, getStandardTickUnits, getTickUnit, getUpperMargin, isInverted, setAutoRangeIncludesZero, setAutoRangeMinimumSize, setAutoRangeStickyZero, setInverted, setLowerMargin, setStandardTickUnits, setTickUnit, setUpperMargin
 
Methods inherited from class com.jrefinery.chart.ValueAxis
centerRange, getAnchorValue, getCrosshairPaint, getCrosshairStroke, getCrosshairValue, getFixedAutoRange, getGridPaint, getGridStroke, getMaximumAxisValue, getMinimumAxisValue, getRange, isAutoRange, isAutoTickUnitSelection, isCrosshairLockedOnData, isCrosshairVisible, resizeRange, resizeRange, setAnchorValue, setAutoRange, setAutoTickUnitSelection, setCrosshairLockedOnData, setCrosshairPaint, setCrosshairStroke, setCrosshairValue, setCrosshairVisible, setFixedAutoRange, setGridLinesVisible, setGridPaint, setGridStroke, setMaximumAxisValue, setMinimumAxisValue, setRange, setRange, setRangeAboutValue
 
Methods inherited from class com.jrefinery.chart.Axis
addChangeListener, getFixedDimension, getLabel, getLabelFont, getLabelInsets, getLabelPaint, getMaxTickLabelWidth, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkStroke, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, removeChangeListener, setFixedDimension, setLabel, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkStroke, setTickMarksVisible, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.chart.HorizontalAxis
reserveAxisArea, reserveHeight
 

Field Detail

DEFAULT_SYMBOLIC_GRID_LINE_PAINT

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


symbolicValue

protected java.util.List symbolicValue
The list of symbolic value to display instead of the numeric values


xSymbolicZoomIsAccepted

protected boolean xSymbolicZoomIsAccepted
Enable or not the zoom


symbolicGridLineList

public java.util.List symbolicGridLineList
List of the symbolic grid lines shapes


symbolicGridPaint

protected java.awt.Paint symbolicGridPaint
Color of the dark part of the symbolic grid line


symbolicGridLinesVisible

protected boolean symbolicGridLinesVisible
Flag that indicates whether or not symbolic grid lines are visible.

Constructor Detail

HorizontalSymbolicAxis

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

Parameters:
label - The axis label (null permitted).
sv - The string values

HorizontalSymbolicAxis

public HorizontalSymbolicAxis(java.lang.String label,
                              java.lang.String[] sv,
                              java.awt.Font labelFont,
                              boolean symbolicGridLinesVisible,
                              java.awt.Paint symbolicGridPaint)
Constructs a horizontal symbolic axis.

Parameters:
label - The axis label (null permitted).
sv - The string values
labelFont - The font for displaying the axis label.
minimumAxisValue - The lowest value shown on the axis.
maximumAxisValue - The highest value shown on the axis.

HorizontalSymbolicAxis

public HorizontalSymbolicAxis(java.lang.String label,
                              java.lang.String[] sv,
                              java.awt.Font labelFont,
                              java.awt.Paint labelPaint,
                              java.awt.Insets labelInsets,
                              boolean tickLabelsVisible,
                              java.awt.Font tickLabelFont,
                              java.awt.Paint tickLabelPaint,
                              java.awt.Insets tickLabelInsets,
                              boolean verticalTickLabels,
                              boolean tickMarksVisible,
                              java.awt.Stroke tickMarkStroke,
                              boolean autoRange,
                              boolean autoRangeIncludesZero,
                              boolean autoRangeStickyZero,
                              java.lang.Number autoRangeMinimum,
                              double minimumAxisValue,
                              double maximumAxisValue,
                              boolean inverted,
                              boolean autoTickUnitSelection,
                              NumberTickUnit tickUnit,
                              boolean gridLinesVisible,
                              java.awt.Stroke gridStroke,
                              java.awt.Paint gridPaint,
                              boolean crosshairVisible,
                              double crosshairValue,
                              java.awt.Stroke crosshairStroke,
                              java.awt.Paint crosshairPaint,
                              boolean symbolicGridLinesVisible,
                              java.awt.Paint symbolicGridPaint)
Constructs a new horizontal symbolic axis.

Parameters:
label - The axis label.
labelFont - The font for displaying the axis label.
labelPaint - The paint used to draw the axis label.
labelInsets - Determines the amount of blank space around the label.
labelDrawnVertical - Flag indicating whether or not the label is drawn vertically.
tickLabelsVisible - Flag indicating whether or not tick labels are visible.
tickLabelFont - The font used to display tick labels.
tickLabelPaint - The paint used to draw tick labels.
tickLabelInsets - Determines the amount of blank space around tick labels.
tickMarksVisible - Flag indicating whether or not tick marks are visible.
tickMarkStroke - The stroke used to draw tick marks (if visible).
autoRange - Flag indicating whether or not the axis is automatically scaled to fit the data.
autoRangeIncludesZero - A flag indicating whether or not zero *must* be displayed on axis.
autoRangeMinimum - The smallest automatic range allowed.
minimumAxisValue - The lowest value shown on the axis.
maximumAxisValue - The highest value shown on the axis.
inverted - A flag indicating whether the axis is normal or inverted (inverted means running from positive to negative).
autoTickUnitSelection - A flag indicating whether or not the tick units are selected automatically.
tickUnit - The tick unit.
gridLinesVisible - Flag indicating whether or not grid lines are visible for this axis.
gridStroke - The pen/brush used to display grid lines (if visible).
gridPaint - The color used to display grid lines (if visible).
crosshairValue - The value at which to draw an optional crosshair (null permitted).
crosshairStroke - The pen/brush used to draw the crosshair.
crosshairPaint - The color used to draw the crosshair.
Method Detail

getSymbolicValue

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


getSymbolicGridPaint

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


isGridLinesVisible

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

Overrides:
isGridLinesVisible in class ValueAxis
Returns:
The gridlines flag.

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.


setAnchoredRange

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

Overrides:
setAnchoredRange in class ValueAxis
Parameters:
range - The range.

draw

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

Overrides:
draw in class HorizontalNumberAxis
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)
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

autoAdjustRange

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

Overrides:
autoAdjustRange in class HorizontalNumberAxis


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.