com.ijchart.xychart.annotation
Class CategoryLineAnnotation

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

public class CategoryLineAnnotation
extends AbstractAnnotation
implements ICategoryAnnotation, java.lang.Cloneable, java.io.Serializable

Title: IJChart

A line 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 java.awt.Paint DEFAULT_LINE_PAINT
           The default line paint.
static java.awt.Stroke DEFAULT_LINE_STROKE
           The default line stroke.
 
Constructor Summary
CategoryLineAnnotation(java.lang.Object startCategory, double startValue, java.lang.Object endCategory, double endValue)
           Draw a line from (startCategory,startValue) to (endCategory,endValue).
CategoryLineAnnotation(java.lang.Object startCategory, double startValue, java.lang.Object endCategory, double endValue, java.awt.Paint paint, java.awt.Stroke stroke)
           Draw a line from (startCategory,startValue) to (endCategory,endValue).
 
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.
 java.lang.Object getEndCategory()
           Returns the category for the end of the line.
 double getEndValue()
           Returns the end y value.
 java.awt.Paint getPaint()
           Returns the line paint.
 java.lang.Object getStartCategory()
           Returns the category for the start of the line.
 double getStartValue()
           Returns the start y value.
 java.awt.Stroke getStroke()
           Returns the line stroke.
 int hashCode()
           Returns a hash code value for the object.
 void setEndCategory(java.lang.Object category)
           Sets the category for the end of the line and sends an AnnotationChangeEvent to all registered listeners.
 void setEndValue(double value)
           Sets the end y value and sends an AnnotationChangeEvent to all registered listeners.
 void setPaint(java.awt.Paint paint)
           Sets the line paint and sends an AnnotationChangeEvent to all registered listeners.
 void setStartCategory(java.lang.Object category)
           Sets the category for the start of the line and sends an AnnotationChangeEvent to all registered listeners.
 void setStartValue(double value)
           Sets the start y value and sends an AnnotationChangeEvent to all registered listeners.
 void setStroke(java.awt.Stroke stroke)
           Sets the line stroke and sends an AnnotationChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
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_LINE_PAINT

public static final java.awt.Paint DEFAULT_LINE_PAINT
The default line paint.


DEFAULT_LINE_STROKE

public static final java.awt.Stroke DEFAULT_LINE_STROKE
The default line stroke.

Constructor Detail

CategoryLineAnnotation

public CategoryLineAnnotation(java.lang.Object startCategory,
                              double startValue,
                              java.lang.Object endCategory,
                              double endValue)
Draw a line from (startCategory,startValue) to (endCategory,endValue).

Parameters:
startCategory - Objec The category for the start of the line (null not permitted).
startValue - double The start y value.
endCategory - Object The category for the end of the line (null not permitted).
endValue - double The end y value.

CategoryLineAnnotation

public CategoryLineAnnotation(java.lang.Object startCategory,
                              double startValue,
                              java.lang.Object endCategory,
                              double endValue,
                              java.awt.Paint paint,
                              java.awt.Stroke stroke)
Draw a line from (startCategory,startValue) to (endCategory,endValue).

Parameters:
startCategory - Objec The category for the start of the line (null not permitted).
startValue - double The start y value.
endCategory - Object The category for the end of the line (null not permitted).
endValue - double The end y value.
paint - Paint The line paint (null not permitted).
stroke - Stroke The line stroke (null not permitted).
Method Detail

getStartCategory

public java.lang.Object getStartCategory()
Returns the category for the start of the line.

Returns:
Object The category (never null).

setStartCategory

public void setStartCategory(java.lang.Object category)
Sets the category for the start of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
category - Object The category (null not permitted).

getStartValue

public double getStartValue()
Returns the start y value.

Returns:
double The start value.

setStartValue

public void setStartValue(double value)
Sets the start y value and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
value - double The start value.

getEndCategory

public java.lang.Object getEndCategory()
Returns the category for the end of the line.

Returns:
Object The category (never null).

setEndCategory

public void setEndCategory(java.lang.Object category)
Sets the category for the end of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
category - Object The category (null not permitted).

getEndValue

public double getEndValue()
Returns the end y value.

Returns:
double The end value.

setEndValue

public void setEndValue(double value)
Sets the end y value and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
value - double The end value.

getPaint

public java.awt.Paint getPaint()
Returns the line paint.

Returns:
Paint The line paint (never null).

setPaint

public void setPaint(java.awt.Paint paint)
Sets the line paint and sends an AnnotationChangeEvent to all registered listeners.

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

getStroke

public java.awt.Stroke getStroke()
Returns the line stroke.

Returns:
Stroke The line stroke (never null).

setStroke

public void setStroke(java.awt.Stroke stroke)
Sets the line stroke and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The line 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
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 AbstractAnnotation
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 AbstractAnnotation
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 AbstractAnnotation
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 java.lang.Object
Returns:
a string representation of the object.