JFreeChart 1.0.14-redhat-2

org.jfree.chart.annotations
Class CategoryLineAnnotation

java.lang.Object
  extended by org.jfree.chart.annotations.AbstractAnnotation
      extended by org.jfree.chart.annotations.CategoryLineAnnotation
All Implemented Interfaces:
Serializable, Cloneable, Annotation, CategoryAnnotation, org.jfree.util.PublicCloneable

public class CategoryLineAnnotation
extends AbstractAnnotation
implements CategoryAnnotation, Cloneable, org.jfree.util.PublicCloneable, Serializable

A line annotation that can be placed on a CategoryPlot.

See Also:
Serialized Form

Constructor Summary
CategoryLineAnnotation(Comparable category1, double value1, Comparable category2, double value2, Paint paint, Stroke stroke)
          Creates a new annotation that draws a line between (category1, value1) and (category2, value2).
 
Method Summary
 Object clone()
          Returns a clone of the annotation.
 void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)
          Draws the annotation.
 boolean equals(Object obj)
          Tests this object for equality with another.
 Comparable getCategory1()
          Returns the category for the start of the line.
 Comparable getCategory2()
          Returns the category for the end of the line.
 Paint getPaint()
          Returns the paint used to draw the connecting line.
 Stroke getStroke()
          Returns the stroke used to draw the connecting line.
 double getValue1()
          Returns the y-value for the start of the line.
 double getValue2()
          Returns the y-value for the end of the line.
 int hashCode()
          Returns a hash code for this instance.
 void setCategory1(Comparable category)
          Sets the category for the start of the line and sends an AnnotationChangeEvent to all registered listeners.
 void setCategory2(Comparable category)
          Sets the category for the end of the line and sends an AnnotationChangeEvent to all registered listeners.
 void setPaint(Paint paint)
          Sets the paint used to draw the connecting line and sends an AnnotationChangeEvent to all registered listeners.
 void setStroke(Stroke stroke)
          Sets the stroke used to draw the connecting line and sends an AnnotationChangeEvent to all registered listeners.
 void setValue1(double value)
          Sets the y-value for the start of the line and sends an AnnotationChangeEvent to all registered listeners.
 void setValue2(double value)
          Sets the y-value for the end of the line and sends an AnnotationChangeEvent to all registered listeners.
 
Methods inherited from class org.jfree.chart.annotations.AbstractAnnotation
addChangeListener, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotify
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.chart.annotations.Annotation
addChangeListener, removeChangeListener
 

Constructor Detail

CategoryLineAnnotation

public CategoryLineAnnotation(Comparable category1,
                              double value1,
                              Comparable category2,
                              double value2,
                              Paint paint,
                              Stroke stroke)
Creates a new annotation that draws a line between (category1, value1) and (category2, value2).

Parameters:
category1 - the category (null not permitted).
value1 - the value.
category2 - the category (null not permitted).
value2 - the value.
paint - the line color (null not permitted).
stroke - the line stroke (null not permitted).
Method Detail

getCategory1

public Comparable getCategory1()
Returns the category for the start of the line.

Returns:
The category for the start of the line (never null).
See Also:
setCategory1(Comparable)

setCategory1

public void setCategory1(Comparable category)
Sets the category for the start of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
category - the category (null not permitted).
See Also:
getCategory1()

getValue1

public double getValue1()
Returns the y-value for the start of the line.

Returns:
The y-value for the start of the line.
See Also:
setValue1(double)

setValue1

public void setValue1(double value)
Sets the y-value for the start of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
value - the value.
See Also:
getValue1()

getCategory2

public Comparable getCategory2()
Returns the category for the end of the line.

Returns:
The category for the end of the line (never null).
See Also:
setCategory2(Comparable)

setCategory2

public void setCategory2(Comparable category)
Sets the category for the end of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
category - the category (null not permitted).
See Also:
getCategory2()

getValue2

public double getValue2()
Returns the y-value for the end of the line.

Returns:
The y-value for the end of the line.
See Also:
setValue2(double)

setValue2

public void setValue2(double value)
Sets the y-value for the end of the line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
value - the value.
See Also:
getValue2()

getPaint

public Paint getPaint()
Returns the paint used to draw the connecting line.

Returns:
The paint (never null).
See Also:
setPaint(Paint)

setPaint

public void setPaint(Paint paint)
Sets the paint used to draw the connecting line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
paint - the paint (null not permitted).
See Also:
getPaint()

getStroke

public Stroke getStroke()
Returns the stroke used to draw the connecting line.

Returns:
The stroke (never null).
See Also:
setStroke(Stroke)

setStroke

public void setStroke(Stroke stroke)
Sets the stroke used to draw the connecting line and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
stroke - the stroke (null not permitted).
See Also:
getStroke()

draw

public void draw(Graphics2D g2,
                 CategoryPlot plot,
                 Rectangle2D dataArea,
                 CategoryAxis domainAxis,
                 ValueAxis rangeAxis)
Draws the annotation.

Specified by:
draw in interface CategoryAnnotation
Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.
domainAxis - the domain axis.
rangeAxis - the range axis.

equals

public boolean equals(Object obj)
Tests this object for equality with another.

Overrides:
equals in class Object
Parameters:
obj - the object (null permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code for this instance.

Overrides:
hashCode in class Object
Returns:
A hash code.

clone

public Object clone()
             throws CloneNotSupportedException
Returns a clone of the annotation.

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class AbstractAnnotation
Returns:
A clone.
Throws:
CloneNotSupportedException - this class will not throw this exception, but subclasses (if any) might.

JFreeChart 1.0.14-redhat-2

Copyright © 2001-2012 JFree.org. All Rights Reserved.