Package org.jfree.chart.axis
Class Axis
- java.lang.Object
-
- org.jfree.chart.axis.Axis
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
CategoryAxis,ValueAxis
public abstract class Axis extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
The base class for all axes in JFreeChart. Subclasses are divided into those that display values (ValueAxis) and those that display categories (CategoryAxis).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.FontDEFAULT_AXIS_LABEL_FONTThe default axis label font.static org.jfree.ui.RectangleInsetsDEFAULT_AXIS_LABEL_INSETSThe default axis label insets.static java.awt.PaintDEFAULT_AXIS_LABEL_PAINTThe default axis label paint.static java.awt.PaintDEFAULT_AXIS_LINE_PAINTThe default axis line paint.static java.awt.StrokeDEFAULT_AXIS_LINE_STROKEThe default axis line stroke.static booleanDEFAULT_AXIS_VISIBLEThe default axis visibility.static java.awt.FontDEFAULT_TICK_LABEL_FONTThe default tick label font.static org.jfree.ui.RectangleInsetsDEFAULT_TICK_LABEL_INSETSThe default tick label insets.static java.awt.PaintDEFAULT_TICK_LABEL_PAINTThe default tick label paint.static booleanDEFAULT_TICK_LABELS_VISIBLEThe default tick labels visibility.static floatDEFAULT_TICK_MARK_INSIDE_LENGTHThe default tick mark inside length.static floatDEFAULT_TICK_MARK_OUTSIDE_LENGTHThe default tick mark outside length.static java.awt.PaintDEFAULT_TICK_MARK_PAINTThe default tick paint.static java.awt.StrokeDEFAULT_TICK_MARK_STROKEThe default tick stroke.static booleanDEFAULT_TICK_MARKS_VISIBLEThe default tick marks visible.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAxis(java.lang.String label)Constructs an axis, using default values where necessary.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(AxisChangeListener listener)Registers an object for notification of changes to the axis.java.lang.Objectclone()Returns a clone of the axis.abstract voidconfigure()Configures the axis to work with the current plot.protected voidcreateAndAddEntity(double cursor, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)Created an entity for the axis.java.text.AttributedStringcreateAttributedLabel(java.lang.String label)Creates and returns anAttributedStringwith the specified text and the labelFont and labelPaint applied as attributes.abstract AxisStatedraw(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.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).protected AxisStatedrawAttributedLabel(java.text.AttributedString label, java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)Draws the axis label.protected voiddrawAxisLine(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Draws an axis line at the current cursor position and edge.protected AxisStatedrawLabel(java.lang.String label, java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)Draws the axis label.booleanequals(java.lang.Object obj)Tests this axis for equality with another object.protected voidfireChangeEvent()Sends anAxisChangeEventto all registered listeners.java.text.AttributedStringgetAttributedLabel()Returns the attributed label (the returned value is a copy, so modifying it will not impact the state of the axis).java.awt.PaintgetAxisLinePaint()Returns the paint used to draw the axis line.java.awt.StrokegetAxisLineStroke()Returns the stroke used to draw the axis line.doublegetFixedDimension()Returns the fixed dimension for the axis.java.lang.StringgetLabel()Returns the label for the axis.doublegetLabelAngle()Returns the angle of the axis label.protected java.awt.geom.Rectangle2DgetLabelEnclosure(java.awt.Graphics2D g2, org.jfree.ui.RectangleEdge edge)Returns a rectangle that encloses the axis label.java.awt.FontgetLabelFont()Returns the font for the axis label.org.jfree.ui.RectangleInsetsgetLabelInsets()Returns the insets for the label (that is, the amount of blank space that should be left around the label).AxisLabelLocationgetLabelLocation()Returns the location of the axis label.java.awt.PaintgetLabelPaint()Returns the color/shade used to draw the axis label.floatgetMinorTickMarkInsideLength()Returns the inside length of the minor tick marks.floatgetMinorTickMarkOutsideLength()Returns the outside length of the minor tick marks.PlotgetPlot()Returns the plot that the axis is assigned to.java.awt.FontgetTickLabelFont()Returns the font used for the tick labels (if showing).org.jfree.ui.RectangleInsetsgetTickLabelInsets()Returns the insets for the tick labels.java.awt.PaintgetTickLabelPaint()Returns the color/shade used for the tick labels.floatgetTickMarkInsideLength()Returns the inside length of the tick marks.floatgetTickMarkOutsideLength()Returns the outside length of the tick marks.java.awt.PaintgetTickMarkPaint()Returns the paint used to draw tick marks (if they are showing).java.awt.StrokegetTickMarkStroke()Returns the stroke used to draw tick marks.inthashCode()Returns a hash code for this instance.booleanhasListener(java.util.EventListener listener)Returnstrueif the specified object is registered with the dataset as a listener.booleanisAxisLineVisible()A flag that controls whether or not the axis line is drawn.booleanisMinorTickMarksVisible()Returns the flag that indicates whether or not the minor tick marks are showing.booleanisTickLabelsVisible()Returns a flag indicating whether or not the tick labels are visible.booleanisTickMarksVisible()Returns the flag that indicates whether or not the tick marks are showing.booleanisVisible()Returnstrueif the axis is visible, andfalseotherwise.protected org.jfree.ui.TextAnchorlabelAnchorH(AxisLabelLocation location)protected org.jfree.ui.TextAnchorlabelAnchorV(AxisLabelLocation location)protected doublelabelLocationX(AxisLabelLocation location, java.awt.geom.Rectangle2D dataArea)protected doublelabelLocationY(AxisLabelLocation location, java.awt.geom.Rectangle2D dataArea)protected voidnotifyListeners(AxisChangeEvent event)Notifies all registered listeners that the axis has changed.abstract java.util.ListrefreshTicks(java.awt.Graphics2D g2, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the ticks for the axis, storing the results in the tick list (ready for drawing).voidremoveChangeListener(AxisChangeListener listener)Deregisters an object for notification of changes to the axis.abstract AxisSpacereserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)Estimates the space (height or width) required to draw the axis.voidsetAttributedLabel(java.lang.String label)Sets the attributed label for the axis and sends anAxisChangeEventto all registered listeners.voidsetAttributedLabel(java.text.AttributedString label)Sets the attributed label for the axis and sends anAxisChangeEventto all registered listeners.voidsetAxisLinePaint(java.awt.Paint paint)Sets the paint used to draw the axis line and sends anAxisChangeEventto all registered listeners.voidsetAxisLineStroke(java.awt.Stroke stroke)Sets the stroke used to draw the axis line and sends anAxisChangeEventto all registered listeners.voidsetAxisLineVisible(boolean visible)Sets a flag that controls whether or not the axis line is visible and sends anAxisChangeEventto all registered listeners.voidsetFixedDimension(double dimension)Sets the fixed dimension for the axis.voidsetLabel(java.lang.String label)Sets the label for the axis and sends anAxisChangeEventto all registered listeners.voidsetLabelAngle(double angle)Sets the angle for the label and sends anAxisChangeEventto all registered listeners.voidsetLabelFont(java.awt.Font font)Sets the font for the axis label and sends anAxisChangeEventto all registered listeners.voidsetLabelInsets(org.jfree.ui.RectangleInsets insets)Sets the insets for the axis label, and sends anAxisChangeEventto all registered listeners.voidsetLabelInsets(org.jfree.ui.RectangleInsets insets, boolean notify)Sets the insets for the axis label, and sends anAxisChangeEventto all registered listeners.voidsetLabelLocation(AxisLabelLocation location)Sets the axis label location and sends anAxisChangeEventto all registered listeners.voidsetLabelPaint(java.awt.Paint paint)Sets the paint used to draw the axis label and sends anAxisChangeEventto all registered listeners.voidsetMinorTickMarkInsideLength(float length)Sets the inside length of the minor tick marks and sends anAxisChangeEventto all registered listeners.voidsetMinorTickMarkOutsideLength(float length)Sets the outside length of the minor tick marks and sends anAxisChangeEventto all registered listeners.voidsetMinorTickMarksVisible(boolean flag)Sets the flag that indicates whether or not the minor tick marks are showing and sends anAxisChangeEventto all registered listeners.voidsetPlot(Plot plot)Sets a reference to the plot that the axis is assigned to.voidsetTickLabelFont(java.awt.Font font)Sets the font for the tick labels and sends anAxisChangeEventto all registered listeners.voidsetTickLabelInsets(org.jfree.ui.RectangleInsets insets)Sets the insets for the tick labels and sends anAxisChangeEventto all registered listeners.voidsetTickLabelPaint(java.awt.Paint paint)Sets the paint used to draw tick labels (if they are showing) and sends anAxisChangeEventto all registered listeners.voidsetTickLabelsVisible(boolean flag)Sets the flag that determines whether or not the tick labels are visible and sends anAxisChangeEventto all registered listeners.voidsetTickMarkInsideLength(float length)Sets the inside length of the tick marks and sends anAxisChangeEventto all registered listeners.voidsetTickMarkOutsideLength(float length)Sets the outside length of the tick marks and sends anAxisChangeEventto all registered listeners.voidsetTickMarkPaint(java.awt.Paint paint)Sets the paint used to draw tick marks and sends anAxisChangeEventto all registered listeners.voidsetTickMarkStroke(java.awt.Stroke stroke)Sets the stroke used to draw tick marks and sends anAxisChangeEventto all registered listeners.voidsetTickMarksVisible(boolean flag)Sets the flag that indicates whether or not the tick marks are showing and sends anAxisChangeEventto all registered listeners.voidsetVisible(boolean flag)Sets a flag that controls whether or not the axis is visible and sends anAxisChangeEventto all registered listeners.
-
-
-
Field Detail
-
DEFAULT_AXIS_VISIBLE
public static final boolean DEFAULT_AXIS_VISIBLE
The default axis visibility.- See Also:
- Constant Field Values
-
DEFAULT_AXIS_LABEL_FONT
public static final java.awt.Font DEFAULT_AXIS_LABEL_FONT
The default axis label font.
-
DEFAULT_AXIS_LABEL_PAINT
public static final java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
The default axis label paint.
-
DEFAULT_AXIS_LABEL_INSETS
public static final org.jfree.ui.RectangleInsets DEFAULT_AXIS_LABEL_INSETS
The default axis label insets.
-
DEFAULT_AXIS_LINE_PAINT
public static final java.awt.Paint DEFAULT_AXIS_LINE_PAINT
The default axis line paint.
-
DEFAULT_AXIS_LINE_STROKE
public static final java.awt.Stroke DEFAULT_AXIS_LINE_STROKE
The default axis line stroke.
-
DEFAULT_TICK_LABELS_VISIBLE
public static final boolean DEFAULT_TICK_LABELS_VISIBLE
The default tick labels visibility.- See Also:
- Constant Field Values
-
DEFAULT_TICK_LABEL_FONT
public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
The default tick label font.
-
DEFAULT_TICK_LABEL_PAINT
public static final java.awt.Paint DEFAULT_TICK_LABEL_PAINT
The default tick label paint.
-
DEFAULT_TICK_LABEL_INSETS
public static final org.jfree.ui.RectangleInsets DEFAULT_TICK_LABEL_INSETS
The default tick label insets.
-
DEFAULT_TICK_MARKS_VISIBLE
public static final boolean DEFAULT_TICK_MARKS_VISIBLE
The default tick marks visible.- See Also:
- Constant Field Values
-
DEFAULT_TICK_MARK_STROKE
public static final java.awt.Stroke DEFAULT_TICK_MARK_STROKE
The default tick stroke.
-
DEFAULT_TICK_MARK_PAINT
public static final java.awt.Paint DEFAULT_TICK_MARK_PAINT
The default tick paint.
-
DEFAULT_TICK_MARK_INSIDE_LENGTH
public static final float DEFAULT_TICK_MARK_INSIDE_LENGTH
The default tick mark inside length.- See Also:
- Constant Field Values
-
DEFAULT_TICK_MARK_OUTSIDE_LENGTH
public static final float DEFAULT_TICK_MARK_OUTSIDE_LENGTH
The default tick mark outside length.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Axis
protected Axis(java.lang.String label)
Constructs an axis, using default values where necessary.- Parameters:
label- the axis label (nullpermitted).
-
-
Method Detail
-
isVisible
public boolean isVisible()
Returnstrueif the axis is visible, andfalseotherwise.- Returns:
- A boolean.
- See Also:
setVisible(boolean)
-
setVisible
public void setVisible(boolean flag)
Sets a flag that controls whether or not the axis is visible and sends anAxisChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
isVisible()
-
getLabel
public java.lang.String getLabel()
Returns the label for the axis.- Returns:
- The label for the axis (
nullpossible). - See Also:
getLabelFont(),getLabelPaint(),setLabel(String)
-
setLabel
public void setLabel(java.lang.String label)
Sets the label for the axis and sends anAxisChangeEventto all registered listeners.- Parameters:
label- the new label (nullpermitted).- See Also:
getLabel(),setLabelFont(Font),setLabelPaint(Paint)
-
getAttributedLabel
public java.text.AttributedString getAttributedLabel()
Returns the attributed label (the returned value is a copy, so modifying it will not impact the state of the axis). The default value isnull.- Returns:
- The attributed label (possibly
null). - Since:
- 1.0.16
-
setAttributedLabel
public void setAttributedLabel(java.lang.String label)
Sets the attributed label for the axis and sends anAxisChangeEventto all registered listeners. This is a convenience method that converts the string into anAttributedStringusing the current font attributes.- Parameters:
label- the label (nullpermitted).- Since:
- 1.0.16
-
setAttributedLabel
public void setAttributedLabel(java.text.AttributedString label)
Sets the attributed label for the axis and sends anAxisChangeEventto all registered listeners.- Parameters:
label- the label (nullpermitted).- Since:
- 1.0.16
-
createAttributedLabel
public java.text.AttributedString createAttributedLabel(java.lang.String label)
Creates and returns anAttributedStringwith the specified text and the labelFont and labelPaint applied as attributes.- Parameters:
label- the label (nullpermitted).- Returns:
- An attributed string or
null. - Since:
- 1.0.16
-
getLabelFont
public java.awt.Font getLabelFont()
Returns the font for the axis label.- Returns:
- The font (never
null). - See Also:
setLabelFont(Font)
-
setLabelFont
public void setLabelFont(java.awt.Font font)
Sets the font for the axis label and sends anAxisChangeEventto all registered listeners.- Parameters:
font- the font (nullnot permitted).- See Also:
getLabelFont()
-
getLabelPaint
public java.awt.Paint getLabelPaint()
Returns the color/shade used to draw the axis label.- Returns:
- The paint (never
null). - See Also:
setLabelPaint(Paint)
-
setLabelPaint
public void setLabelPaint(java.awt.Paint paint)
Sets the paint used to draw the axis label and sends anAxisChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getLabelPaint()
-
getLabelInsets
public org.jfree.ui.RectangleInsets getLabelInsets()
Returns the insets for the label (that is, the amount of blank space that should be left around the label).- Returns:
- The label insets (never
null). - See Also:
setLabelInsets(RectangleInsets)
-
setLabelInsets
public void setLabelInsets(org.jfree.ui.RectangleInsets insets)
Sets the insets for the axis label, and sends anAxisChangeEventto all registered listeners.- Parameters:
insets- the insets (nullnot permitted).- See Also:
getLabelInsets()
-
setLabelInsets
public void setLabelInsets(org.jfree.ui.RectangleInsets insets, boolean notify)
Sets the insets for the axis label, and sends anAxisChangeEventto all registered listeners.- Parameters:
insets- the insets (nullnot permitted).notify- notify listeners?- Since:
- 1.0.10
-
getLabelAngle
public double getLabelAngle()
Returns the angle of the axis label.- Returns:
- The angle (in radians).
- See Also:
setLabelAngle(double)
-
setLabelAngle
public void setLabelAngle(double angle)
Sets the angle for the label and sends anAxisChangeEventto all registered listeners.- Parameters:
angle- the angle (in radians).- See Also:
getLabelAngle()
-
getLabelLocation
public AxisLabelLocation getLabelLocation()
Returns the location of the axis label. The default isAxisLabelLocation.MIDDLE.- Returns:
- The location of the axis label (never
null). - Since:
- 1.0.16
-
setLabelLocation
public void setLabelLocation(AxisLabelLocation location)
Sets the axis label location and sends anAxisChangeEventto all registered listeners.- Parameters:
location- the new location (nullnot permitted).- Since:
- 1.0.16
-
isAxisLineVisible
public boolean isAxisLineVisible()
A flag that controls whether or not the axis line is drawn.- Returns:
- A boolean.
- See Also:
getAxisLinePaint(),getAxisLineStroke(),setAxisLineVisible(boolean)
-
setAxisLineVisible
public void setAxisLineVisible(boolean visible)
Sets a flag that controls whether or not the axis line is visible and sends anAxisChangeEventto all registered listeners.- Parameters:
visible- the flag.- See Also:
isAxisLineVisible(),setAxisLinePaint(Paint),setAxisLineStroke(Stroke)
-
getAxisLinePaint
public java.awt.Paint getAxisLinePaint()
Returns the paint used to draw the axis line.- Returns:
- The paint (never
null). - See Also:
setAxisLinePaint(Paint)
-
setAxisLinePaint
public void setAxisLinePaint(java.awt.Paint paint)
Sets the paint used to draw the axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getAxisLinePaint()
-
getAxisLineStroke
public java.awt.Stroke getAxisLineStroke()
Returns the stroke used to draw the axis line.- Returns:
- The stroke (never
null). - See Also:
setAxisLineStroke(Stroke)
-
setAxisLineStroke
public void setAxisLineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
getAxisLineStroke()
-
isTickLabelsVisible
public boolean isTickLabelsVisible()
Returns a flag indicating whether or not the tick labels are visible.- Returns:
- The flag.
- See Also:
getTickLabelFont(),getTickLabelPaint(),setTickLabelsVisible(boolean)
-
setTickLabelsVisible
public void setTickLabelsVisible(boolean flag)
Sets the flag that determines whether or not the tick labels are visible and sends anAxisChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
isTickLabelsVisible(),setTickLabelFont(Font),setTickLabelPaint(Paint)
-
isMinorTickMarksVisible
public boolean isMinorTickMarksVisible()
Returns the flag that indicates whether or not the minor tick marks are showing.- Returns:
- The flag that indicates whether or not the minor tick marks are showing.
- Since:
- 1.0.12
- See Also:
setMinorTickMarksVisible(boolean)
-
setMinorTickMarksVisible
public void setMinorTickMarksVisible(boolean flag)
Sets the flag that indicates whether or not the minor tick marks are showing and sends anAxisChangeEventto all registered listeners.- Parameters:
flag- the flag.- Since:
- 1.0.12
- See Also:
isMinorTickMarksVisible()
-
getTickLabelFont
public java.awt.Font getTickLabelFont()
Returns the font used for the tick labels (if showing).- Returns:
- The font (never
null). - See Also:
setTickLabelFont(Font)
-
setTickLabelFont
public void setTickLabelFont(java.awt.Font font)
Sets the font for the tick labels and sends anAxisChangeEventto all registered listeners.- Parameters:
font- the font (nullnot allowed).- See Also:
getTickLabelFont()
-
getTickLabelPaint
public java.awt.Paint getTickLabelPaint()
Returns the color/shade used for the tick labels.- Returns:
- The paint used for the tick labels.
- See Also:
setTickLabelPaint(Paint)
-
setTickLabelPaint
public void setTickLabelPaint(java.awt.Paint paint)
Sets the paint used to draw tick labels (if they are showing) and sends anAxisChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getTickLabelPaint()
-
getTickLabelInsets
public org.jfree.ui.RectangleInsets getTickLabelInsets()
Returns the insets for the tick labels.- Returns:
- The insets (never
null). - See Also:
setTickLabelInsets(RectangleInsets)
-
setTickLabelInsets
public void setTickLabelInsets(org.jfree.ui.RectangleInsets insets)
Sets the insets for the tick labels and sends anAxisChangeEventto all registered listeners.- Parameters:
insets- the insets (nullnot permitted).- See Also:
getTickLabelInsets()
-
isTickMarksVisible
public boolean isTickMarksVisible()
Returns the flag that indicates whether or not the tick marks are showing.- Returns:
- The flag that indicates whether or not the tick marks are showing.
- See Also:
setTickMarksVisible(boolean)
-
setTickMarksVisible
public void setTickMarksVisible(boolean flag)
Sets the flag that indicates whether or not the tick marks are showing and sends anAxisChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
isTickMarksVisible()
-
getTickMarkInsideLength
public float getTickMarkInsideLength()
Returns the inside length of the tick marks.- Returns:
- The length.
- See Also:
getTickMarkOutsideLength(),setTickMarkInsideLength(float)
-
setTickMarkInsideLength
public void setTickMarkInsideLength(float length)
Sets the inside length of the tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
length- the new length.- See Also:
getTickMarkInsideLength()
-
getTickMarkOutsideLength
public float getTickMarkOutsideLength()
Returns the outside length of the tick marks.- Returns:
- The length.
- See Also:
getTickMarkInsideLength(),setTickMarkOutsideLength(float)
-
setTickMarkOutsideLength
public void setTickMarkOutsideLength(float length)
Sets the outside length of the tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
length- the new length.- See Also:
getTickMarkInsideLength()
-
getTickMarkStroke
public java.awt.Stroke getTickMarkStroke()
Returns the stroke used to draw tick marks.- Returns:
- The stroke (never
null). - See Also:
setTickMarkStroke(Stroke)
-
setTickMarkStroke
public void setTickMarkStroke(java.awt.Stroke stroke)
Sets the stroke used to draw tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
getTickMarkStroke()
-
getTickMarkPaint
public java.awt.Paint getTickMarkPaint()
Returns the paint used to draw tick marks (if they are showing).- Returns:
- The paint (never
null). - See Also:
setTickMarkPaint(Paint)
-
setTickMarkPaint
public void setTickMarkPaint(java.awt.Paint paint)
Sets the paint used to draw tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getTickMarkPaint()
-
getMinorTickMarkInsideLength
public float getMinorTickMarkInsideLength()
Returns the inside length of the minor tick marks.- Returns:
- The length.
- Since:
- 1.0.12
- See Also:
getMinorTickMarkOutsideLength(),setMinorTickMarkInsideLength(float)
-
setMinorTickMarkInsideLength
public void setMinorTickMarkInsideLength(float length)
Sets the inside length of the minor tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
length- the new length.- Since:
- 1.0.12
- See Also:
getMinorTickMarkInsideLength()
-
getMinorTickMarkOutsideLength
public float getMinorTickMarkOutsideLength()
Returns the outside length of the minor tick marks.- Returns:
- The length.
- Since:
- 1.0.12
- See Also:
getMinorTickMarkInsideLength(),setMinorTickMarkOutsideLength(float)
-
setMinorTickMarkOutsideLength
public void setMinorTickMarkOutsideLength(float length)
Sets the outside length of the minor tick marks and sends anAxisChangeEventto all registered listeners.- Parameters:
length- the new length.- Since:
- 1.0.12
- See Also:
getMinorTickMarkInsideLength()
-
getPlot
public Plot getPlot()
Returns the plot that the axis is assigned to. This method will returnnullif the axis is not currently assigned to a plot.- Returns:
- The plot that the axis is assigned to (possibly
null). - See Also:
setPlot(Plot)
-
setPlot
public void setPlot(Plot plot)
Sets a reference to the plot that the axis is assigned to.This method is used internally, you shouldn't need to call it yourself.
- Parameters:
plot- the plot.- See Also:
getPlot()
-
getFixedDimension
public double getFixedDimension()
Returns the fixed dimension for the axis.- Returns:
- The fixed dimension.
- See Also:
setFixedDimension(double)
-
setFixedDimension
public void setFixedDimension(double dimension)
Sets the fixed dimension for the axis.This is used when combining more than one plot on a chart. In this case, there may be several axes that need to have the same height or width so that they are aligned. This method is used to fix a dimension for the axis (the context determines whether the dimension is horizontal or vertical).
- Parameters:
dimension- the fixed dimension.- See Also:
getFixedDimension()
-
configure
public abstract void configure()
Configures the axis to work with the current plot. Override this method to perform any special processing (such as auto-rescaling).
-
reserveSpace
public abstract AxisSpace reserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
Estimates the space (height or width) required to draw the axis.- Parameters:
g2- the graphics device.plot- the plot that the axis belongs to.plotArea- the area within which the plot (including axes) should be drawn.edge- the axis location.space- space already reserved.- Returns:
- The space required to draw the axis (including pre-reserved space).
-
draw
public abstract AxisState draw(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.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).- Parameters:
g2- the graphics device (nullnot permitted).cursor- the cursor location (determines where to draw the axis).plotArea- the area within which the axes and plot should be drawn.dataArea- the area within which the data should be drawn.edge- the axis location (nullnot permitted).plotState- collects information about the plot (nullpermitted).- Returns:
- The axis state (never
null).
-
refreshTicks
public abstract java.util.List refreshTicks(java.awt.Graphics2D g2, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
Calculates the positions of the ticks for the axis, storing the results in the tick list (ready for drawing).- Parameters:
g2- the graphics device.state- the axis state.dataArea- the area inside the axes.edge- the edge on which the axis is located.- Returns:
- The list of ticks.
-
createAndAddEntity
protected void createAndAddEntity(double cursor, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)
Created an entity for the axis.- Parameters:
cursor- the initial cursor value.state- the axis state after completion of the drawing with a possibly updated cursor position.dataArea- the data area.edge- the edge.plotState- the PlotRenderingInfo from which a reference to the entity collection can be obtained.- Since:
- 1.0.13
-
addChangeListener
public void addChangeListener(AxisChangeListener listener)
Registers an object for notification of changes to the axis.- Parameters:
listener- the object that is being registered.- See Also:
removeChangeListener(AxisChangeListener)
-
removeChangeListener
public void removeChangeListener(AxisChangeListener listener)
Deregisters an object for notification of changes to the axis.- Parameters:
listener- the object to deregister.- See Also:
addChangeListener(AxisChangeListener)
-
hasListener
public boolean hasListener(java.util.EventListener listener)
Returnstrueif the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.- Parameters:
listener- the listener.- Returns:
- A boolean.
-
notifyListeners
protected void notifyListeners(AxisChangeEvent event)
Notifies all registered listeners that the axis has changed. The AxisChangeEvent provides information about the change.- Parameters:
event- information about the change to the axis.
-
fireChangeEvent
protected void fireChangeEvent()
Sends anAxisChangeEventto all registered listeners.- Since:
- 1.0.12
-
getLabelEnclosure
protected java.awt.geom.Rectangle2D getLabelEnclosure(java.awt.Graphics2D g2, org.jfree.ui.RectangleEdge edge)
Returns a rectangle that encloses the axis label. This is typically used for layout purposes (it gives the maximum dimensions of the label).- Parameters:
g2- the graphics device.edge- the edge of the plot area along which the axis is measuring.- Returns:
- The enclosing rectangle.
-
labelLocationX
protected double labelLocationX(AxisLabelLocation location, java.awt.geom.Rectangle2D dataArea)
-
labelLocationY
protected double labelLocationY(AxisLabelLocation location, java.awt.geom.Rectangle2D dataArea)
-
labelAnchorH
protected org.jfree.ui.TextAnchor labelAnchorH(AxisLabelLocation location)
-
labelAnchorV
protected org.jfree.ui.TextAnchor labelAnchorV(AxisLabelLocation location)
-
drawLabel
protected AxisState drawLabel(java.lang.String label, java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)
Draws the axis label.- Parameters:
label- the label text.g2- the graphics device.plotArea- the plot area.dataArea- the area inside the axes.edge- the location of the axis.state- the axis state (nullnot permitted).- Returns:
- Information about the axis.
-
drawAttributedLabel
protected AxisState drawAttributedLabel(java.text.AttributedString label, java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)
Draws the axis label.- Parameters:
label- the label text.g2- the graphics device.plotArea- the plot area.dataArea- the area inside the axes.edge- the location of the axis.state- the axis state (nullnot permitted).- Returns:
- Information about the axis.
- Since:
- 1.0.16
-
drawAxisLine
protected void drawAxisLine(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
Draws an axis line at the current cursor position and edge.- Parameters:
g2- the graphics device.cursor- the cursor position.dataArea- the data area.edge- the edge.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the axis.- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- if some component of the axis does not support cloning.
-
equals
public boolean equals(java.lang.Object obj)
Tests this axis for equality with another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code.
-
-