|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.chart.Axis | +--com.jrefinery.chart.ValueAxis | +--com.jrefinery.chart.DateAxis | +--com.jrefinery.chart.HorizontalDateAxis
A horizontal axis that displays date values.
Used in XY plots where the x-values in the dataset are interpreted as milliseconds, encoded in the same way as java.util.Date.
You can also use this axis as the range axis in a HorizontalCategoryPlot.
XYPlot
,
HorizontalCategoryPlot
Fields inherited from class com.jrefinery.chart.DateAxis |
DEFAULT_ANCHOR_DATE, DEFAULT_CROSSHAIR_DATE, DEFAULT_DATE_TICK_UNIT |
Fields inherited from class com.jrefinery.chart.ValueAxis |
DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_CROSSHAIR_PAINT, DEFAULT_CROSSHAIR_STROKE, DEFAULT_CROSSHAIR_VISIBLE, DEFAULT_GRID_LINE_PAINT, DEFAULT_GRID_LINE_STROKE, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT |
Fields inherited from class com.jrefinery.chart.Axis |
fixedDimension, label, labelFont, labelInsets, labelPaint, plot, tickLabelFont, tickLabelInsets, tickLabelPaint, tickLabelsVisible, tickMarkPaint, 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_PAINT, DEFAULT_TICK_STROKE |
Constructor Summary | |
HorizontalDateAxis()
Constructs a new date axis, using default attribute values where necessary. |
|
HorizontalDateAxis(java.lang.String label)
Constructs a new date axis, using default attribute values where necessary. |
|
HorizontalDateAxis(java.lang.String label,
java.awt.Font labelFont,
java.awt.Paint labelPaint,
java.awt.Insets labelInsets,
boolean showTickLabels,
java.awt.Font tickLabelFont,
java.awt.Paint tickLabelPaint,
java.awt.Insets tickLabelInsets,
boolean verticalTickLabels,
boolean showTickMarks,
java.awt.Stroke tickMarkStroke,
java.awt.Paint tickMarkPaint,
boolean autoRange,
java.lang.Number autoRangeMinimumSize,
Range range,
boolean autoTickUnitSelection,
TickUnits standardTickUnits,
DateTickUnit tickUnit,
java.text.SimpleDateFormat tickLabelFormatter,
boolean gridVisible,
java.awt.Stroke gridStroke,
java.awt.Paint gridPaint,
java.util.Date anchorDate,
boolean crosshairVisible,
java.util.Date crosshairDate,
java.awt.Stroke crosshairStroke,
java.awt.Paint crosshairPaint)
Constructs a new date axis. |
|
HorizontalDateAxis(java.lang.String label,
java.awt.Font labelFont,
Range range)
Constructs a new date axis, using default attribute values where necessary. |
Method Summary | |
protected void |
autoAdjustRange()
Rescales the axis to ensure that all data is visible. |
void |
configure()
Configures the axis to work with the specified plot. |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D drawArea,
java.awt.geom.Rectangle2D plotArea)
Draws the axis on a Java 2D graphics device (such as the screen or a printer). |
boolean |
getVerticalTickLabels()
Returns true if the tick labels should be rotated to vertical, and false for standard horizontal labels. |
protected boolean |
isCompatiblePlot(Plot plot)
Returns true if the specified plot is compatible with the axis. |
void |
refreshTicks(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D drawArea,
java.awt.geom.Rectangle2D plotArea)
Recalculates the ticks for the date axis. |
java.awt.geom.Rectangle2D |
reserveAxisArea(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D drawArea,
double reservedWidth)
Returns area in which the axis will be displayed. |
double |
reserveHeight(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D drawArea)
Returns the height required to draw the axis in the specified draw area. |
void |
setVerticalTickLabels(boolean flag)
Sets the flag that determines the orientation of the tick labels. |
double |
translateDateToJava2D(java.util.Date date,
java.awt.geom.Rectangle2D dataArea)
Translates a date to Java2D coordinates, based on the range displayed by this axis for the specified data area. |
double |
translateJava2DtoValue(float java2DValue,
java.awt.geom.Rectangle2D dataArea)
Translates the Java2D (horizontal) coordinate back to the corresponding data value. |
double |
translateValueToJava2D(double value,
java.awt.geom.Rectangle2D dataArea)
Translates the data value to the display coordinates (Java 2D User Space) of the chart. |
Methods inherited from class com.jrefinery.chart.DateAxis |
calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, createStandardDateTickUnits, getAnchorDate, getCrosshairDate, getMaximumDate, getMinimumDate, getTickUnit, nextStandardDate, previousStandardDate, setAnchorDate, setAnchorValue, setAxisRange, setCrosshairDate, setMaximumDate, setMinimumDate, setRange, setRange, setRange, setTickUnit, setTickUnitAttribute |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HorizontalDateAxis()
The new axis has no label.
public HorizontalDateAxis(java.lang.String label)
label
- the axis label (null permitted).public HorizontalDateAxis(java.lang.String label, java.awt.Font labelFont, Range range)
label
- the axis label (null permitted).labelFont
- the font for displaying the axis label.range
- the axis range.public HorizontalDateAxis(java.lang.String label, java.awt.Font labelFont, java.awt.Paint labelPaint, java.awt.Insets labelInsets, boolean showTickLabels, java.awt.Font tickLabelFont, java.awt.Paint tickLabelPaint, java.awt.Insets tickLabelInsets, boolean verticalTickLabels, boolean showTickMarks, java.awt.Stroke tickMarkStroke, java.awt.Paint tickMarkPaint, boolean autoRange, java.lang.Number autoRangeMinimumSize, Range range, boolean autoTickUnitSelection, TickUnits standardTickUnits, DateTickUnit tickUnit, java.text.SimpleDateFormat tickLabelFormatter, boolean gridVisible, java.awt.Stroke gridStroke, java.awt.Paint gridPaint, java.util.Date anchorDate, boolean crosshairVisible, java.util.Date crosshairDate, java.awt.Stroke crosshairStroke, java.awt.Paint crosshairPaint)
label
- the axis label (null permitted).labelFont
- the font for displaying the axis label.labelPaint
- the paint used to draw the axis label.labelInsets
- the blank space around the axis label.showTickLabels
- flag indicating whether or not tick labels are visible.tickLabelFont
- font for displaying tick labels.tickLabelPaint
- the paint used to display the tick labels.tickLabelInsets
- the blank space around the tick labels.verticalTickLabels
- a flag indicating whether tick labels are drawn vertically.showTickMarks
- flag indicating whether or not tick marks are visible.tickMarkStroke
- the stroke used to draw tick marks (if visible).tickMarkPaint
- the paint used to draw tick marks (if visible).autoRange
- flag indicating whether the axis is automatically scaled to fit the data.autoRangeMinimumSize
- the smallest range allowed when the axis range is calculated to
fit the data.range
- the axis range.autoTickUnitSelection
- a flag indicating whether the tick units are automatically
selected.standardTickUnits
- a collection of standard tick units.tickUnit
- the tick unit.tickLabelFormatter
- the format object used to display tick labels.gridVisible
- flag indicating whether or not grid lines are visible for this axis.gridStroke
- the Stroke used to display grid lines (if visible).gridPaint
- the Paint used to display grid lines (if visible).anchorDate
- the anchor date.crosshairVisible
- whether to show a crosshair.crosshairDate
- the date at which to draw the crosshair line (null permitted).crosshairStroke
- the pen/brush used to draw the data line.crosshairPaint
- the color used to draw the data line.Method Detail |
public boolean getVerticalTickLabels()
public void setVerticalTickLabels(boolean flag)
Registered listeners are notified that the axis has been changed.
flag
- the flag.public void configure()
configure
in class Axis
public double translateDateToJava2D(java.util.Date date, java.awt.geom.Rectangle2D dataArea)
date
- the date.dataArea
- the rectangle (in Java2D space) where the data is to be plotted.public double translateValueToJava2D(double value, java.awt.geom.Rectangle2D dataArea)
translateValueToJava2D
in class ValueAxis
value
- the date to be plotted.dataArea
- the rectangle (in Java2D space) where the data is to be plotted.public double translateJava2DtoValue(float java2DValue, java.awt.geom.Rectangle2D dataArea)
translateJava2DtoValue
in class ValueAxis
java2DValue
- the coordinate in Java2D space.dataArea
- the rectangle (in Java2D space) where the data is to be plotted.protected void autoAdjustRange()
autoAdjustRange
in class ValueAxis
public void refreshTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea)
refreshTicks
in class Axis
g2
- the graphics device.drawArea
- the area in which the axes and data are to be drawn.plotArea
- the area in which the data is to be drawn.public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea)
draw
in class Axis
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).public double reserveHeight(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea)
reserveHeight
in interface HorizontalAxis
g2
- the graphics device.plot
- the plot that the axis belongs to.drawArea
- the area within which the plot should be drawn.public java.awt.geom.Rectangle2D reserveAxisArea(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea, double reservedWidth)
reserveAxisArea
in interface HorizontalAxis
g2
- the graphics device.plot
- the plot.drawArea
- the drawing area.reservedWidth
- the width already reserved for the vertical axis.protected boolean isCompatiblePlot(Plot plot)
The HorizontalDateAxis class expects the plot to implement the HorizontalValuePlot interface.
isCompatiblePlot
in class Axis
plot
- the plot.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |