|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.chart.axis.Axis
org.jfree.chart.axis.CategoryAxis
An axis that displays categories.
Field Summary | |
static double |
DEFAULT_AXIS_MARGIN
The default margin for the axis (used for both lower and upper margins). |
static double |
DEFAULT_CATEGORY_MARGIN
The default margin between categories (a percentage of the overall axis length). |
Constructor Summary | |
CategoryAxis(java.lang.String label)
Constructs a category axis, using default values where necessary. |
Method Summary | |
protected double |
calculateCategoryGapSize(int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Calculates the size (width or height, depending on the location of the axis) of a category gap. |
protected double |
calculateCategorySize(int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Calculates the size (width or height, depending on the location of the axis) of a category. |
protected double |
calculateTextBlockHeight(org.jfree.text.TextBlock block,
CategoryLabelPosition position,
java.awt.Graphics2D g2)
A utility method for determining the height of a text block. |
protected double |
calculateTextBlockWidth(org.jfree.text.TextBlock block,
CategoryLabelPosition position,
java.awt.Graphics2D g2)
A utility method for determining the width of a text block. |
java.lang.Object |
clone()
Creates a clone of the axis. |
void |
configure()
Configures the axis against the current plot. |
protected org.jfree.text.TextBlock |
createLabel(java.lang.Comparable category,
float width,
org.jfree.ui.RectangleEdge edge,
java.awt.Graphics2D g2)
Creates a label. |
AxisState |
draw(java.awt.Graphics2D g2,
double cursor,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the axis on a Java 2D graphics device (such as the screen or a printer). |
protected AxisState |
drawCategoryLabels(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge,
AxisState state)
Draws the category labels when the axis is 'horizontal'. |
boolean |
equals(java.lang.Object obj)
Tests this axis for equality with another object. |
CategoryLabelPosition |
getBottomCategoryLabelPosition()
Deprecated. Use getCategoryLabelPositions().getLabelPosition(RectangleEdge.BOTTOM). |
double |
getCategoryEnd(int category,
int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Returns the end coordinate for the specified category. |
double |
getCategoryJava2DCoordinate(CategoryAnchor anchor,
int category,
int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Returns the Java 2D coordinate for a category. |
int |
getCategoryLabelPositionOffset()
Returns the offset between the axis and the category labels (before label positioning is taken into account). |
CategoryLabelPositions |
getCategoryLabelPositions()
Returns the category label position specification (this contains label positioning info for all four possible axis locations). |
double |
getCategoryMargin()
Returns the category margin. |
double |
getCategoryMiddle(int category,
int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Returns the middle coordinate for the specified category. |
double |
getCategoryStart(int category,
int categoryCount,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Returns the starting coordinate for the specified category. |
CategoryLabelPosition |
getLeftCategoryLabelPosition()
Deprecated. Use getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT). |
double |
getLowerMargin()
Returns the lower margin for the axis. |
float |
getMaxCategoryLabelWidthRatio()
Returns the category label width ratio. |
CategoryLabelPosition |
getRightCategoryLabelPosition()
Deprecated. Use getCategoryLabelPositions().getLabelPosition(RectangleEdge.RIGHT). |
boolean |
getSkipCategoryLabelsToFit()
Deprecated. No longer supported. |
CategoryLabelPosition |
getTopCategoryLabelPosition()
Deprecated. Use getCategoryLabelPositions().getLabelPosition(RectangleEdge.TOP). |
double |
getUpperMargin()
Returns the upper margin for the axis. |
boolean |
isVerticalCategoryLabels()
Deprecated. Use the get/setXXXCategoryLabelPosition methods. |
java.util.List |
refreshTicks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Creates a temporary list of ticks that can be used when drawing the axis. |
AxisSpace |
reserveSpace(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D plotArea,
org.jfree.ui.RectangleEdge edge,
AxisSpace space)
Estimates the space required for the axis, given a specific drawing area. |
void |
setBottomCategoryLabelPosition(CategoryLabelPosition position)
Deprecated. Use setCategoryLabelPositions(...). |
void |
setCategoryLabelPositionOffset(int offset)
Sets the offset between the axis and the category labels (before label positioning is taken into account). |
void |
setCategoryLabelPositions(CategoryLabelPositions positions)
Sets the category label position specification for the axis. |
void |
setCategoryMargin(double margin)
Sets the category margin. |
void |
setLeftCategoryLabelPosition(CategoryLabelPosition position)
Deprecated. Use setCategoryLabelPositions(...). |
void |
setLowerMargin(double margin)
Sets the lower margin for the axis. |
void |
setMaxCategoryLabelWidthRatio(float ratio)
Sets the maximum category label width ratio. |
void |
setRightCategoryLabelPosition(CategoryLabelPosition position)
Deprecated. Use setLabelPositions(...). |
void |
setSkipCategoryLabelsToFit(boolean flag)
Deprecated. No longer supported. |
void |
setTopCategoryLabelPosition(CategoryLabelPosition position)
Deprecated. Use setCategoryLabelPositions(...). |
void |
setUpperMargin(double margin)
Sets the upper margin for the axis. |
void |
setVerticalCategoryLabels(boolean flag)
Deprecated. Use the get/setXXXCategoryLabelPosition methods. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double DEFAULT_AXIS_MARGIN
public static final double DEFAULT_CATEGORY_MARGIN
Constructor Detail |
public CategoryAxis(java.lang.String label)
label
- the axis label (null
permitted).Method Detail |
public double getLowerMargin()
public void setLowerMargin(double margin)
AxisChangeEvent
is sent to all registered
listeners.
margin
- the margin (a percentage of the axis length).public double getUpperMargin()
public void setUpperMargin(double margin)
AxisChangeEvent
is sent to all registered
listeners.
margin
- the margin (a percentage of the axis length).public double getCategoryMargin()
public void setCategoryMargin(double margin)
AxisChangeEvent
is sent to all registered
listeners.
The overall category margin is distributed over N-1 gaps, where N is the number of categories on the axis.
margin
- the margin (a percentage of the axis length).public float getMaxCategoryLabelWidthRatio()
public void setMaxCategoryLabelWidthRatio(float ratio)
ratio
- the ratio.public int getCategoryLabelPositionOffset()
public void setCategoryLabelPositionOffset(int offset)
offset
- the offset.public CategoryLabelPositions getCategoryLabelPositions()
public void setCategoryLabelPositions(CategoryLabelPositions positions)
positions
- the category label position specification.public CategoryLabelPosition getTopCategoryLabelPosition()
public void setTopCategoryLabelPosition(CategoryLabelPosition position)
position
- the position info.public CategoryLabelPosition getBottomCategoryLabelPosition()
public void setBottomCategoryLabelPosition(CategoryLabelPosition position)
position
- the position info.public CategoryLabelPosition getLeftCategoryLabelPosition()
public void setLeftCategoryLabelPosition(CategoryLabelPosition position)
position
- the position info.public CategoryLabelPosition getRightCategoryLabelPosition()
public void setRightCategoryLabelPosition(CategoryLabelPosition position)
position
- the position info.public double getCategoryJava2DCoordinate(CategoryAnchor anchor, int category, int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
anchor
- the anchor point.category
- the category index.categoryCount
- the category count.area
- the data area.edge
- the location of the axis.
public double getCategoryStart(int category, int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
category
- the category.categoryCount
- the number of categories.area
- the data area.edge
- the axis location.
public double getCategoryMiddle(int category, int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
category
- the category.categoryCount
- the number of categories.area
- the data area.edge
- the axis location.
public double getCategoryEnd(int category, int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
category
- the category.categoryCount
- the number of categories.area
- the data area.edge
- the axis location.
protected double calculateCategorySize(int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
categoryCount
- the number of categories.area
- the area within which the categories will be drawn.edge
- the axis location.
protected double calculateCategoryGapSize(int categoryCount, java.awt.geom.Rectangle2D area, org.jfree.ui.RectangleEdge edge)
categoryCount
- the number of categories.area
- the area within which the categories will be drawn.edge
- the axis location.
public AxisSpace reserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
reserveSpace
in class Axis
g2
- the graphics device (used to obtain font information).plot
- the plot that the axis belongs to.plotArea
- the area within which the axis should be drawn.edge
- the axis location (top or bottom).space
- the space already reserved.
public void configure()
configure
in class Axis
public AxisState draw(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
draw
in class Axis
g2
- the graphics device.cursor
- the cursor location.plotArea
- the area within which the axis should be drawn.dataArea
- the area within which the plot is being drawn.edge
- the location of the axis.
protected AxisState drawCategoryLabels(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)
g2
- the graphics device.plotArea
- the plot area.dataArea
- the area inside the axes.edge
- the axis location.state
- the axis state.
public java.util.List refreshTicks(java.awt.Graphics2D g2, AxisState state, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
refreshTicks
in class Axis
g2
- the graphics device (used to get font measurements).state
- the axis state.plotArea
- the area where the plot and axes will be drawn.dataArea
- the area inside the axes.edge
- the location of the axis.
protected org.jfree.text.TextBlock createLabel(java.lang.Comparable category, float width, org.jfree.ui.RectangleEdge edge, java.awt.Graphics2D g2)
category
- the category.width
- the available width.edge
- the edge on which the axis appears.g2
- the graphics device.
protected double calculateTextBlockWidth(org.jfree.text.TextBlock block, CategoryLabelPosition position, java.awt.Graphics2D g2)
block
- the text block.position
- the position.g2
- the graphics device.
protected double calculateTextBlockHeight(org.jfree.text.TextBlock block, CategoryLabelPosition position, java.awt.Graphics2D g2)
block
- the text block.position
- the label position.g2
- the graphics device.
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class Axis
java.lang.CloneNotSupportedException
- if some component of the axis does not support cloning.public boolean equals(java.lang.Object obj)
equals
in class Axis
obj
- the object.
true
or false
.public boolean isVerticalCategoryLabels()
public void setVerticalCategoryLabels(boolean flag)
flag
- the flag.public boolean getSkipCategoryLabelsToFit()
public void setSkipCategoryLabelsToFit(boolean flag)
flag
- the new value of the flag.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |