public class

SymbolAxis

extends NumberAxis
implements Serializable
java.lang.Object
   ↳ org.jfree.chart.axis.Axis
     ↳ org.jfree.chart.axis.ValueAxis
       ↳ org.jfree.chart.axis.NumberAxis
         ↳ org.jfree.chart.axis.SymbolAxis

Class Overview

A standard linear value axis that replaces integer values with symbols.

Summary

[Expand]
Inherited Constants
From class org.jfree.chart.axis.NumberAxis
From class org.jfree.chart.axis.ValueAxis
From class org.jfree.chart.axis.Axis
Fields
public static final Paint DEFAULT_GRID_BAND_ALTERNATE_PAINT The default paint for alternate grid bands.
public static final Paint DEFAULT_GRID_BAND_PAINT The default grid band paint.
[Expand]
Inherited Fields
From class org.jfree.chart.axis.NumberAxis
From class org.jfree.chart.axis.ValueAxis
From class org.jfree.chart.axis.Axis
Public Constructors
SymbolAxis(String label, String[] sv)
Constructs a symbol axis, using default attribute values where necessary.
Public Methods
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).
boolean equals(Object obj)
Tests this axis for equality with an arbitrary object.
Paint getGridBandAlternatePaint()
Returns the paint used for alternate grid bands.
Paint getGridBandPaint()
Returns the paint used to color the grid bands.
String[] getSymbols()
Returns an array of the symbols for the axis.
boolean isGridBandsVisible()
Returns true if the grid bands are showing, and false otherwise.
List 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).
void setGridBandAlternatePaint(Paint paint)
Sets the paint used for alternate grid bands and sends a AxisChangeEvent to all registered listeners.
void setGridBandPaint(Paint paint)
Sets the grid band paint and sends an AxisChangeEvent to all registered listeners.
void setGridBandsVisible(boolean flag)
Sets the visibility of the grid bands and notifies registered listeners that the axis has been modified.
String valueToString(double value)
Converts a value to a string, using the list of symbols.
Protected Methods
void autoAdjustRange()
Rescales the axis to ensure that all data is visible.
void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks)
Draws the grid bands.
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.
void drawGridBandsVertical(Graphics2D g2, Rectangle2D drawArea, Rectangle2D plotArea, boolean firstGridBandIsDark, List ticks)
Draws the grid bands for the axis when it is at the top or bottom of the plot.
List refreshTicksHorizontal(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).
List refreshTicksVertical(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).
void selectAutoTickUnit(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge)
This operation is not supported by this axis.
[Expand]
Inherited Methods
From class org.jfree.chart.axis.NumberAxis
From class org.jfree.chart.axis.ValueAxis
From class org.jfree.chart.axis.Axis
From class java.lang.Object

Fields

public static final Paint DEFAULT_GRID_BAND_ALTERNATE_PAINT

The default paint for alternate grid bands.

public static final Paint DEFAULT_GRID_BAND_PAINT

The default grid band paint.

Public Constructors

public SymbolAxis (String label, String[] sv)

Constructs a symbol axis, using default attribute values where necessary.

Parameters
label the axis label (null permitted).
sv the list of symbols to display instead of the numeric values.

Public Methods

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).

Parameters
g2 the graphics device (null not permitted).
cursor the cursor location.
plotArea the area within which the plot and axes should be drawn (null not permitted).
dataArea the area within which the data should be drawn (null not permitted).
edge the axis location (null not permitted).
plotState collects information about the plot (null permitted).
Returns
  • The axis state (never null).

public boolean equals (Object obj)

Tests this axis for equality with an arbitrary object.

Parameters
obj the object (null permitted).
Returns
  • A boolean.

public Paint getGridBandAlternatePaint ()

Returns the paint used for alternate grid bands.

Returns
  • The paint (never null).

public Paint getGridBandPaint ()

Returns the paint used to color the grid bands.

Returns
  • The grid band paint (never null).

public String[] getSymbols ()

Returns an array of the symbols for the axis.

Returns
  • The symbols.

public boolean isGridBandsVisible ()

Returns true if the grid bands are showing, and false otherwise.

Returns
  • true if the grid bands are showing, and false otherwise.

public List 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).

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.

public void setGridBandAlternatePaint (Paint paint)

Sets the paint used for alternate grid bands and sends a AxisChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setGridBandPaint (Paint paint)

Sets the grid band paint and sends an AxisChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setGridBandsVisible (boolean flag)

Sets the visibility of the grid bands and notifies registered listeners that the axis has been modified.

Parameters
flag the new setting.

public String valueToString (double value)

Converts a value to a string, using the list of symbols.

Parameters
value value to convert.
Returns
  • The symbol.

Protected Methods

protected void autoAdjustRange ()

Rescales the axis to ensure that all data is visible.

protected void drawGridBands (Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks)

Draws the grid bands. Alternate bands are colored using gridBandPaint (DEFAULT_GRID_BAND_PAINT by default).

Parameters
g2 the graphics device.
plotArea the area within which the chart should be drawn.
dataArea the area within which the plot should be drawn (a subset of the drawArea).
edge the axis location.
ticks the ticks.

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 device.
plotArea the area within which the chart should be drawn.
dataArea the area within which the plot should be drawn (a subset of the drawArea).
firstGridBandIsDark True: the first grid band takes the color of gridBandPaint. False: the second grid band takes the color of gridBandPaint.
ticks the ticks.

protected void drawGridBandsVertical (Graphics2D g2, Rectangle2D drawArea, Rectangle2D plotArea, 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 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).
firstGridBandIsDark True: the first grid band takes the color of gridBandPaint. False: the second grid band takes the color of gridBandPaint.
ticks a list of ticks.

protected List refreshTicksHorizontal (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).

Parameters
g2 the graphics device.
dataArea the area in which the data should be drawn.
edge the location of the axis.
Returns
  • The ticks.

protected List refreshTicksVertical (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).

Parameters
g2 the graphics device.
dataArea the area in which the plot should be drawn.
edge the location of the axis.
Returns
  • The ticks.

protected void selectAutoTickUnit (Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge)

This operation is not supported by this axis.

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.