com.ijchart.xychart.annotation
Class XYLineAnnotation

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

public class XYLineAnnotation
extends AbstractAnnotation
implements IXYAnnotation, java.lang.Cloneable, java.io.Serializable

Title: IJChart

A text annotation that can be placed on a XYPlot.

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
XYLineAnnotation(double startX, double startY, double endX, double endY)
           Draw a line from (startX,startY) to (endX,endY).
XYLineAnnotation(double startX, double startY, double endX, double endY, java.awt.Paint paint, java.awt.Stroke stroke)
           Draw a line from (startX,startY) to (endX,endY).
 
Method Summary
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void drawAnnotation(AbstractValueAxis xAxis, RectangleEdge xAxisEdge, AbstractValueAxis yAxis, RectangleEdge yAxisEdge, 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 getEndX()
           Returns the end x value.
 double getEndY()
           Returns the end y value.
 java.awt.Paint getPaint()
           Returns the line paint.
 double getStartX()
           Returns the start x value.
 double getStartY()
           Returns the start y value.
 java.awt.Stroke getStroke()
           Returns the line stroke.
 int hashCode()
           Returns a hash code value for the object.
 void setEndX(double endX)
           Sets the end x value and sends an AnnotationChangeEvent to all registered listeners.
 void setEndY(double endY)
           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 setStartX(double startX)
           Sets the start x value and sends an AnnotationChangeEvent to all registered listeners.
 void setStartY(double startY)
           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

XYLineAnnotation

public XYLineAnnotation(double startX,
                        double startY,
                        double endX,
                        double endY)
Draw a line from (startX,startY) to (endX,endY).

Parameters:
startX - double The start x value.
startY - double The start y value.
endX - double The end x value.
endY - double The end y value.

XYLineAnnotation

public XYLineAnnotation(double startX,
                        double startY,
                        double endX,
                        double endY,
                        java.awt.Paint paint,
                        java.awt.Stroke stroke)
Draw a line from (startX,startY) to (endX,endY).

Parameters:
startX - double The start x value.
startY - double The start y value.
endX - double The end x value.
endY - double The end y value.
paint - Paint The line paint (null not permitted).
stroke - Stroke The line stroke (null not permitted).
Method Detail

getStartX

public double getStartX()
Returns the start x value.

Returns:
double The start x value.

setStartX

public void setStartX(double startX)
Sets the start x value and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
startX - double The start x value.

getStartY

public double getStartY()
Returns the start y value.

Returns:
double The start y value.

setStartY

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

Parameters:
startY - double The start y value.

getEndX

public double getEndX()
Returns the end x value.

Returns:
double The end x value.

setEndX

public void setEndX(double endX)
Sets the end x value and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
endX - double The end x value.

getEndY

public double getEndY()
Returns the end y value.

Returns:
double The end y value.

setEndY

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

Parameters:
endY - double The end y 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(AbstractValueAxis xAxis,
                           RectangleEdge xAxisEdge,
                           AbstractValueAxis yAxis,
                           RectangleEdge yAxisEdge,
                           java.awt.geom.Rectangle2D dataArea,
                           ChartOrientation orientation,
                           AnnotationShapeCollection annotationShapes)
Draws the annotation.

Specified by:
drawAnnotation in interface IXYAnnotation
Parameters:
xAxis - AbstractValueAxis The x-axis (null not permitted).
xAxisEdge - RectangleEdge The x-axis edge (null not permitted).
yAxis - AbstractValueAxis The y-axis (null not permitted).
yAxisEdge - RectangleEdge The y-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.