Class CategoryLineAnnotation
java.lang.Object
org.jfree.chart.annotations.AbstractAnnotation
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:
-
Constructor Summary
ConstructorsConstructorDescriptionCategoryLineAnnotation(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
Modifier and TypeMethodDescriptionclone()Returns a clone of the annotation.voiddraw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) Draws the annotation.booleanTests this object for equality with another.Returns the category for the start of the line.Returns the category for the end of the line.getPaint()Returns the paint used to draw the connecting line.Returns the stroke used to draw the connecting line.doubleReturns the y-value for the start of the line.doubleReturns the y-value for the end of the line.inthashCode()Returns a hash code for this instance.voidsetCategory1(Comparable category) Sets the category for the start of the line and sends anAnnotationChangeEventto all registered listeners.voidsetCategory2(Comparable category) Sets the category for the end of the line and sends anAnnotationChangeEventto all registered listeners.voidSets the paint used to draw the connecting line and sends anAnnotationChangeEventto all registered listeners.voidSets the stroke used to draw the connecting line and sends anAnnotationChangeEventto all registered listeners.voidsetValue1(double value) Sets the y-value for the start of the line and sends anAnnotationChangeEventto all registered listeners.voidsetValue2(double value) Sets the y-value for the end of the line and sends anAnnotationChangeEventto all registered listeners.Methods inherited from class AbstractAnnotation
addChangeListener, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotifyMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Annotation
addChangeListener, removeChangeListener
-
Constructor Details
-
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 (nullnot permitted).value1- the value.category2- the category (nullnot permitted).value2- the value.paint- the line color (nullnot permitted).stroke- the line stroke (nullnot permitted).
-
-
Method Details
-
getCategory1
Returns the category for the start of the line.- Returns:
- The category for the start of the line (never
null). - See Also:
-
setCategory1
Sets the category for the start of the line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
category- the category (nullnot permitted).- See Also:
-
getValue1
Returns the y-value for the start of the line.- Returns:
- The y-value for the start of the line.
- See Also:
-
setValue1
Sets the y-value for the start of the line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
value- the value.- See Also:
-
getCategory2
Returns the category for the end of the line.- Returns:
- The category for the end of the line (never
null). - See Also:
-
setCategory2
Sets the category for the end of the line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
category- the category (nullnot permitted).- See Also:
-
getValue2
Returns the y-value for the end of the line.- Returns:
- The y-value for the end of the line.
- See Also:
-
setValue2
Sets the y-value for the end of the line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
value- the value.- See Also:
-
getPaint
-
setPaint
Sets the paint used to draw the connecting line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
getStroke
-
setStroke
Sets the stroke used to draw the connecting line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
-
draw
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) Draws the annotation.- Specified by:
drawin interfaceCategoryAnnotation- Parameters:
g2- the graphics device.plot- the plot.dataArea- the data area.domainAxis- the domain axis.rangeAxis- the range axis.
-
equals
-
hashCode
-
clone
Returns a clone of the annotation.- Specified by:
clonein interfaceorg.jfree.util.PublicCloneable- Overrides:
clonein classAbstractAnnotation- Returns:
- A clone.
- Throws:
CloneNotSupportedException- this class will not throw this exception, but subclasses (if any) might.
-