Class SymbolicAxis

All Implemented Interfaces:
Serializable, Cloneable, org.jfree.util.PublicCloneable

public class SymbolicAxis
extends NumberAxis
implements Serializable
A standard linear value axis, for SYMBOLIC values.
Author:
Anthony Boulestreau
See Also:
Serialized Form
  • Field Details

    • DEFAULT_SYMBOLIC_GRID_LINE_PAINT

      public static final Paint DEFAULT_SYMBOLIC_GRID_LINE_PAINT
      The default symbolic grid line paint.
  • Constructor Details

    • SymbolicAxis

      public SymbolicAxis​(String label, String[] sv)
      Constructs a symbolic axis, using default attribute values where necessary.
      Parameters:
      label - the axis label (null permitted).
      sv - the list of symbolic values to display instead of the numeric value.
  • Method Details

    • getSymbolicValue

      public String[] getSymbolicValue()
      Returns the list of the symbolic values to display.
      Returns:
      list of symbolic values.
    • getSymbolicGridPaint

      public 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, and false otherwise.
    • 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.
    • draw

      public AxisState draw​(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)
      Draws the axis on a Java 2D graphics device (such as the screen or a printer).
      Overrides:
      draw in class NumberAxis
      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).
    • drawSymbolicGridLines

      public void drawSymbolicGridLines​(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, List ticks)
      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.
      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.
    • drawSymbolicGridLinesHorizontal

      public void drawSymbolicGridLinesHorizontal​(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, boolean firstGridLineIsDark, List ticks)
      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.
      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).
      firstGridLineIsDark - True: the first symbolic grid line take the color of symbolicGridPaint. False: the first symbolic grid line is white.
      ticks - the ticks.
    • getSymbolicGridLine

      public 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.
    • refreshTicks

      public List refreshTicks​(Graphics2D g2, AxisState state, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
      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 NumberAxis
      Parameters:
      g2 - the graphics device.
      state - the axis state.
      plotArea - the area in which the plot (inlcuding axes) should be drawn.
      dataArea - the area in which the data should be drawn.
      edge - the location of the axis.
      Returns:
      A list of ticks.
    • refreshTicksHorizontal

      public List refreshTicksHorizontal​(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.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.
      cursor - the cursor position for drawing the axis.
      plotArea - the area in which the plot (inlcuding axes) should be drawn.
      dataArea - the area in which the data should be drawn.
      edge - the location of the axis.
      Returns:
      The ticks.
    • refreshTicksVertical

      public List refreshTicksVertical​(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.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.
      cursor - the cursor position for drawing the axis.
      plotArea - the area in which the plot and the axes should be drawn.
      dataArea - the area in which the plot should be drawn.
      edge - the location of the axis.
      Returns:
      The ticks.
    • valueToString

      public 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.
    • drawSymbolicGridLinesVertical

      public void drawSymbolicGridLinesVertical​(Graphics2D g2, Rectangle2D drawArea, Rectangle2D plotArea, boolean firstGridLineIsDark, List ticks)
      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.
      ticks - a list of ticks.