com.ijchart.xychart.annotation
Class CategoryTextAndPointerAnnotation

java.lang.Object
  extended by com.ijchart.xychart.annotation.AbstractAnnotation
      extended by com.ijchart.xychart.annotation.AbstractTextAnnotation
          extended by com.ijchart.xychart.annotation.CategoryTextAnnotation
              extended by com.ijchart.xychart.annotation.CategoryTextAndPointerAnnotation
All Implemented Interfaces:
IAnnotation, ICategoryAnnotation, IAnnotationChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class CategoryTextAndPointerAnnotation
extends CategoryTextAnnotation
implements ICategoryAnnotation, java.lang.Cloneable, java.io.Serializable

Title: IJChart

A text and pointer annotation that can be placed on a CategoryPlot.

Description: a chart library for the Java(tm) platform.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static double DEFAULT_ARROW_ANGLE
           The default angle of the arrow's line (in radians).
static double DEFAULT_ARROW_LENGTH
           The default length of the arrow head (in Java2D units).
static java.awt.Paint DEFAULT_ARROW_PAINT
           The default arrow paint.
static java.awt.Stroke DEFAULT_ARROW_STROKE
           The default arrow stroke.
static double DEFAULT_ARROW_WIDTH
           The default arrow width (in Java2D units, per side).
static double DEFAULT_BASE_RADIUS
           The default radius from the (x, y) point to the start of the arrow line (in Java2D units).
static double DEFAULT_LABEL_OFFSET
           The default radius from the base point to the anchor point for the label.
 
Fields inherited from class com.ijchart.xychart.annotation.AbstractTextAnnotation
DEFAULT_FONT, DEFAULT_PAINT, DEFAULT_ROTATION_ANGLE, DEFAULT_TEXT_DIRECTION, DEFAULT_TEXT_HORIZONTAL_ALIGNMENT, DEFAULT_TEXT_POSITION, DEFAULT_TEXT_VERTICAL_ALIGNMENT
 
Constructor Summary
CategoryTextAndPointerAnnotation(java.lang.String text, java.lang.Object category, double value)
           Creates a new annotation to be displayed at the given location.
CategoryTextAndPointerAnnotation(java.lang.String text, java.lang.Object category, double value, double arrowAngle)
           Creates a new annotation to be displayed at the given location.
 
Method Summary
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void drawAnnotation(CategoryAxis categoryAxis, AbstractValueAxis valueAxis, RectangleEdge valueAxisEdge, java.awt.geom.Rectangle2D dataArea, ChartOrientation orientation, AnnotationShapeCollection annotationShapes)
           Draws the annotation.
 boolean equals(java.lang.Object obj)
           Tests this instance for equality with an arbitrary object.
 double getArrowAngle()
           Return the angle of the arrow's line (in radians).
 double getArrowLength()
           Return the length of the arrow head (in Java2D units).
 java.awt.Paint getArrowPaint()
           Returns the arrow paint.
 java.awt.Stroke getArrowStroke()
           Returns the arrow stroke.
 double getArrowWidth()
           Return the arrow width (in Java2D units, per side).
 double getBaseRadius()
           Return the radius from the (x, y) point to the start of the arrow line (in Java2D units).
 double getLabelOffset()
           Return the radius from the base point to the anchor point for the label.
 int hashCode()
           Returns a hash code value for the object.
 void setArrowAngle(double angle)
           Sets the angle of the arrow's line and sends a AnnotationChangeEvent to all registered listeners.
 void setArrowLength(double length)
           Sets the length of the arrow head (in Java2D units) and sends a AnnotationChangeEvent to all registered listeners.
 void setArrowPaint(java.awt.Paint paint)
           Sets the arrow paint and sends a AnnotationChangeEvent to all registered listeners.
 void setArrowStroke(java.awt.Stroke stroke)
           Sets the arrow stroke and sends a AnnotationChangeEvent to all registered listeners.
 void setArrowWidth(double width)
           Sets the arrow width (in Java2D units, per side) and sends a AnnotationChangeEvent to all registered listeners.
 void setBaseRadius(double radius)
           Sets the radius from the (x, y) point to the start of the arrow line (in Java2D units) and sends a AnnotationChangeEvent to all registered listeners.
 void setLabelOffset(double offset)
           Sets the radius from the base point to the anchor point for the label and sends a AnnotationChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
Methods inherited from class com.ijchart.xychart.annotation.CategoryTextAnnotation
getCategory, getValue, setCategory, setValue
 
Methods inherited from class com.ijchart.xychart.annotation.AbstractTextAnnotation
getRotationAngle, getText, getTextDirection, getTextFont, getTextHorizontalAlign, getTextPaint, getTextPosition, getTextVerticalAlign, horizontalAlignToAnchor, setRotationAngle, setText, setTextDirection, setTextFont, setTextHorizontalAlign, setTextPaint, setTextPosition, setTextVerticalAlign
 
Methods inherited from class com.ijchart.xychart.annotation.AbstractAnnotation
addChangeListener, annotationChanged, fireAnnotationChanged, getTooltipText, hasListener, notifyListeners, removeAllChangeListener, removeChangeListener, setTooltipText
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ARROW_ANGLE

public static final double DEFAULT_ARROW_ANGLE
The default angle of the arrow's line (in radians).

See Also:
Constant Field Values

DEFAULT_BASE_RADIUS

public static final double DEFAULT_BASE_RADIUS
The default radius from the (x, y) point to the start of the arrow line (in Java2D units).

See Also:
Constant Field Values

DEFAULT_ARROW_LENGTH

public static final double DEFAULT_ARROW_LENGTH
The default length of the arrow head (in Java2D units).

See Also:
Constant Field Values

DEFAULT_ARROW_WIDTH

public static final double DEFAULT_ARROW_WIDTH
The default arrow width (in Java2D units, per side).

See Also:
Constant Field Values

DEFAULT_ARROW_PAINT

public static final java.awt.Paint DEFAULT_ARROW_PAINT
The default arrow paint.


DEFAULT_ARROW_STROKE

public static final java.awt.Stroke DEFAULT_ARROW_STROKE
The default arrow stroke.


DEFAULT_LABEL_OFFSET

public static final double DEFAULT_LABEL_OFFSET
The default radius from the base point to the anchor point for the label.

See Also:
Constant Field Values
Constructor Detail

CategoryTextAndPointerAnnotation

public CategoryTextAndPointerAnnotation(java.lang.String text,
                                        java.lang.Object category,
                                        double value)
Creates a new annotation to be displayed at the given location.

Parameters:
text - String The text (null not permitted).
category - Object The category (null not permitted).
value - double The value.

CategoryTextAndPointerAnnotation

public CategoryTextAndPointerAnnotation(java.lang.String text,
                                        java.lang.Object category,
                                        double value,
                                        double arrowAngle)
Creates a new annotation to be displayed at the given location.

Parameters:
text - String The text (null not permitted).
category - Object The category (null not permitted).
value - double The value.
arrowAngle - The angle of the arrow's line (in radians).
Method Detail

getArrowAngle

public double getArrowAngle()
Return the angle of the arrow's line (in radians).

Returns:
double The angle.

setArrowAngle

public void setArrowAngle(double angle)
Sets the angle of the arrow's line and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
angle - double The angle (in radians).

getBaseRadius

public double getBaseRadius()
Return the radius from the (x, y) point to the start of the arrow line (in Java2D units).

Returns:
double The radius of arrow.

setBaseRadius

public void setBaseRadius(double radius)
Sets the radius from the (x, y) point to the start of the arrow line (in Java2D units) and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
radius - double The radius of arrow.

getArrowLength

public double getArrowLength()
Return the length of the arrow head (in Java2D units).

Returns:
double The arrow length.

setArrowLength

public void setArrowLength(double length)
Sets the length of the arrow head (in Java2D units) and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
length - double The arrow length.

getArrowWidth

public double getArrowWidth()
Return the arrow width (in Java2D units, per side).

Returns:
double The arrow width.

setArrowWidth

public void setArrowWidth(double width)
Sets the arrow width (in Java2D units, per side) and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
width - double The arrow width.

getLabelOffset

public double getLabelOffset()
Return the radius from the base point to the anchor point for the label.

Returns:
double The radius from the base point to the anchor point for the label.

setLabelOffset

public void setLabelOffset(double offset)
Sets the radius from the base point to the anchor point for the label and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
offset - double The radius from the base point to the anchor point for the label.

getArrowPaint

public java.awt.Paint getArrowPaint()
Returns the arrow paint.

Returns:
Paint The arrow paint (never null).

setArrowPaint

public void setArrowPaint(java.awt.Paint paint)
Sets the arrow paint and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
paint - Paint The arrow paint (null not permitted).

getArrowStroke

public java.awt.Stroke getArrowStroke()
Returns the arrow stroke.

Returns:
Stroke The arrow stroke (never null).

setArrowStroke

public void setArrowStroke(java.awt.Stroke stroke)
Sets the arrow stroke and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The arrow stroke (null not permitted).

drawAnnotation

public void drawAnnotation(CategoryAxis categoryAxis,
                           AbstractValueAxis valueAxis,
                           RectangleEdge valueAxisEdge,
                           java.awt.geom.Rectangle2D dataArea,
                           ChartOrientation orientation,
                           AnnotationShapeCollection annotationShapes)
Draws the annotation.

Specified by:
drawAnnotation in interface ICategoryAnnotation
Overrides:
drawAnnotation in class CategoryTextAnnotation
Parameters:
categoryAxis - CategoryAxis The category axis (null not permitted).
valueAxis - AbstractValueAxis The value axis (null not permitted).
valueAxisEdge - RectangleEdge The value axis edge (null not permitted).
dataArea - Rectangle2D The chart data area (null not permitted).
orientation - ChartOrientation The chart orientation (null not permitted).
annotationShapes - AnnotationShapeCollection Collects information about the annotation (null not permitted).

equals

public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.

Overrides:
equals in class CategoryTextAnnotation
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class CategoryTextAnnotation
Returns:
int A hash code value for this object.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class CategoryTextAnnotation
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class CategoryTextAnnotation
Returns:
a string representation of the object.