anl.aida.plot
Class LegendAxis

java.lang.Object
  extended by org.jfree.chart.axis.Axis
      extended by org.jfree.chart.axis.ValueAxis
          extended by org.jfree.chart.axis.NumberAxis
              extended by anl.aida.plot.LegendAxis
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.jfree.util.PublicCloneable

public class LegendAxis
extends org.jfree.chart.axis.NumberAxis

A NumberAxis that that runs from 0 to the number of colors in a color map. This overrides refreshTicksVertical to label the interval with the color map starting values rather than the actual numeric values in the axis. This also creates a LookupPaintScale for use with this axis so that the paint values in the color map correspond with this axis' values. This whole thing is basically a trick to allow each color map interval to be painted in an equal area, rather than have the painted area correspond to the range of the color map value. That is, if there are two intervals 0 - 10, and 10 - 50, under normal circumstances the legend will paint the 0 - 10 range in 1/5th the space of the 10 - 50 range. This legend axis insures that they each get 1/2.

Version:
$Revision$ $Date$
See Also:
Serialized Form

Field Summary
private  int intervalCount
           
private  ColorMap map
           
private  double max
           
private  double min
           
private  org.jfree.chart.renderer.LookupPaintScale paintScale
           
 
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_LABELS
 
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 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
LegendAxis(java.lang.String label, double min, double max, ColorMap map)
          Constructs a number axis, using default values where necessary.
 
Method Summary
private  org.jfree.chart.renderer.LookupPaintScale createPaintScale(ColorMap map)
           
 org.jfree.chart.renderer.LookupPaintScale getPaintScale()
           
protected  java.util.List refreshTicksVertical(java.awt.Graphics2D g2, java.awt.geom.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).
 
Methods inherited from class org.jfree.chart.axis.NumberAxis
autoAdjustRange, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, draw, equals, estimateMaximumTickLabelHeight, estimateMaximumTickLabelWidth, getAutoRangeIncludesZero, getAutoRangeStickyZero, getMarkerBand, getNumberFormatOverride, getRangeType, getTickUnit, hashCode, java2DToValue, refreshTicks, refreshTicksHorizontal, selectAutoTickUnit, selectHorizontalAutoTickUnit, selectVerticalAutoTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setRangeType, setTickUnit, setTickUnit, valueToJava2D
 
Methods 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, zoomRange
 
Methods inherited from class org.jfree.chart.axis.Axis
addChangeListener, createAndAddEntity, drawLabel, fireChangeEvent, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, removeChangeListener, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelPaint, setMinorTickMarkInsideLength, setMinorTickMarkOutsideLength, setMinorTickMarksVisible, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

min

private double min

max

private double max

intervalCount

private int intervalCount

map

private ColorMap map

paintScale

private org.jfree.chart.renderer.LookupPaintScale paintScale
Constructor Detail

LegendAxis

public LegendAxis(java.lang.String label,
                  double min,
                  double max,
                  ColorMap map)
Constructs a number axis, using default values where necessary.

Parameters:
label - the axis label (null permitted).
Method Detail

createPaintScale

private org.jfree.chart.renderer.LookupPaintScale createPaintScale(ColorMap map)

getPaintScale

public org.jfree.chart.renderer.LookupPaintScale getPaintScale()

refreshTicksVertical

protected java.util.List refreshTicksVertical(java.awt.Graphics2D g2,
                                              java.awt.geom.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:
refreshTicksVertical in class org.jfree.chart.axis.NumberAxis
Parameters:
g2 - the graphics device.
dataArea - the area in which the plot should be drawn.
edge - the location of the axis.
Returns:
A list of ticks.