com.ijchart.xychart.shape
Class ErrorCrossChartShape

java.lang.Object
  extended by com.ijchart.xychart.shape.AbstractChartShape
      extended by com.ijchart.xychart.shape.ErrorCrossChartShape
All Implemented Interfaces:
IChartShapeChangeListener, IChartShape, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class ErrorCrossChartShape
extends AbstractChartShape
implements java.io.Serializable, java.lang.Cloneable

Title: IJChart

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

Draw an error cross IChartShape.

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_CAP_LENGTH
           The default length of the cap at the end of the error bars.
static boolean DEFAULT_DRAW_X_ERROR
           A default flag that controls whether or not the x-error bars are drawn.
static boolean DEFAULT_DRAW_Y_ERROR
           A default flag that controls whether or not the y-error bars are drawn.
 
Fields inherited from class com.ijchart.xychart.shape.AbstractChartShape
DEFAULT_DRAW_TYPE, DEFAULT_SHAPE_ID, DEFAULT_VISIBLE, transformedShape
 
Fields inherited from interface com.ijchart.xychart.shape.IChartShape
DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_CONTENT_PAINT, DEFAULT_DRAW_BORDER, DEFAULT_FILL_ALPHA, DEFAULT_FILL_PAINT, DEFAULT_FILL_SHAPE, DEFAULT_GRADIENT_PAINT_TRANSFORM_TYPE, DEFAULT_MARGIN, DEFAULT_SELECT_FILL_PAINT, DEFAULT_SELECT_RECT_ALPHA, DEFAULT_SELECT_RECT_WIDTH, DEFAULT_SELECTED, DEFAULT_TEXT_FONT, DEFAULT_TOOLTIP_SHAPE_WIDTH, HOTSPOT_TYPE_CIRCLE, HOTSPOT_TYPE_POLYGON, HOTSPOT_TYPE_RECTANGLE
 
Constructor Summary
ErrorCrossChartShape(double startX, double endX, double centerX, double centerY, double startY, double endY, java.awt.Shape centerShape)
           Constructor.
 
Method Summary
protected  void calculateTransformedShape()
           Calculate the transformed shape.
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void draw(java.awt.Graphics2D g2)
           Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer).
protected  void drawSelect(java.awt.Graphics2D g2)
           Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).
 boolean equals(java.lang.Object obj)
           Indicates whether some other object is "equal to" this one.
 double getCapLength()
           Returns the length of the cap at the end of the error bars.
 java.awt.Shape getCenterShape()
           Returns the shape of center point.
 double getCenterX()
           Returns the coordinate of center x.
 double getCenterY()
           Returns the coordinate of center y.
 double getEndX()
           Returns the coordinate of end x.
 double getEndY()
           Returns the coordinate of end y.
protected  java.awt.Shape getHotspotShape()
           Returns the hotspot shape.
 java.awt.geom.Point2D getLockPoint()
           Returns the lock coordinates of this shape.
 ShapeType getShapeType()
           The type for describe this shape.
 double getStartX()
           Returns the coordinate of start x.
 double getStartY()
           Returns the coordinate of start y.
 java.awt.geom.Point2D getTopLeftPoint()
           Returns the top left corner coordinates of this shape (not consider rotation).
 int hashCode()
           Returns a hash code value for the object.
 boolean isDrawXError()
           Returns whether or not the x-error bars are drawn.
 boolean isDrawYError()
           Returns whether or not the y-error bars are drawn,and sends a ChartShapeChangeEvent to all registered listeners.
 void setCapLength(double length)
           Sets the length of the cap at the end of the error bars,and sends a ChartShapeChangeEvent to all registered listeners.
 void setCenterShape(java.awt.Shape shape)
           Sets the shape of center point,and sends a ChartShapeChangeEvent to all registered listeners.
 void setCenterX(double centerX)
           Sets the coordinate of center x,and sends a ChartShapeChangeEvent to all registered listeners.
 void setCenterY(double centerY)
           Sets the coordinate of center y,and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawXError(boolean flag)
           Sets whether or not the x-error bars are drawn,and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawYError(boolean flag)
           Sets whether or not the y-error bars are drawn.
 void setEndX(double endX)
           Sets the coordinate of end x,and sends a ChartShapeChangeEvent to all registered listeners.
 void setEndY(double endY)
           Sets the coordinate of end y,and sends a ChartShapeChangeEvent to all registered listeners.
 void setStartX(double startX)
           Sets the coordinate of start x,and sends a ChartShapeChangeEvent to all registered listeners.
 void setStartY(double startY)
           Sets the coordinate of start y,and sends a ChartShapeChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 void translate(double tx, double ty)
           Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners.
 
Methods inherited from class com.ijchart.xychart.shape.AbstractChartShape
addChangeListener, afterDraw, beforeDraw, chartShapeChanged, contains, contains, drawAnchorByPoints, drawBackground, drawBorder, drawShapeBorder, fillShape, fireChartShapeChanged, forceChartShapeChanged, getBorderPaint, getBorderStroke, getBound, getData, getFillAlpha, getFillPaint, getGradientPaintTransformType, getHotspotPolyCoords, getHotspotType, getHotspotType, getId, getMargin, getOriginTooltipShape, getRotate, getSelectAnchorPaint, getSelectRectAlpha, getSelectRectWidth, getShapeChange, getShapeDrawType, getTooltipShape, getTooltipShapeRotate, getTooltipShapeTranslatePoint, getTooltipText, getURL, hasListener, isDrawBorder, isFillShape, isSelected, isVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setBorderPaint, setBorderStroke, setData, setDrawBorder, setFillAlpha, setFillPaint, setFillShape, setGradientPaintTransformType, setId, setMargin, setOriginTooltipShape, setRotate, setSelectAnchorPaint, setSelected, setSelectRectAlpha, setSelectRectWidth, setShapeChange, setShapeDrawType, setTooltipText, setURL, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DRAW_X_ERROR

public static final boolean DEFAULT_DRAW_X_ERROR
A default flag that controls whether or not the x-error bars are drawn.

See Also:
Constant Field Values

DEFAULT_DRAW_Y_ERROR

public static final boolean DEFAULT_DRAW_Y_ERROR
A default flag that controls whether or not the y-error bars are drawn.

See Also:
Constant Field Values

DEFAULT_CAP_LENGTH

public static final double DEFAULT_CAP_LENGTH
The default length of the cap at the end of the error bars.

See Also:
Constant Field Values
Constructor Detail

ErrorCrossChartShape

public ErrorCrossChartShape(double startX,
                            double endX,
                            double centerX,
                            double centerY,
                            double startY,
                            double endY,
                            java.awt.Shape centerShape)
Constructor.

Parameters:
startX - double The coordinate of start x.
endX - double The coordinate of end x.
centerX - double The coordinate of center x.
centerY - double The coordinate of center y.
startY - double The coordinate of start y.
endY - double The coordinate of end y.
centerShape - Shape The shape of center point (null permitted).
Method Detail

getStartX

public double getStartX()
Returns the coordinate of start x.

Returns:
double The start x coordinate.

setStartX

public void setStartX(double startX)
Sets the coordinate of start x,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
startX - double The start x coordinate.

getEndX

public double getEndX()
Returns the coordinate of end x.

Returns:
double The end x coordinate.

setEndX

public void setEndX(double endX)
Sets the coordinate of end x,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
endX - double The end x coordinate.

getCenterX

public double getCenterX()
Returns the coordinate of center x.

Returns:
double The center x coordinate.

setCenterX

public void setCenterX(double centerX)
Sets the coordinate of center x,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
centerX - double The center x coordinate.

getCenterY

public double getCenterY()
Returns the coordinate of center y.

Returns:
double The center y coordinate.

setCenterY

public void setCenterY(double centerY)
Sets the coordinate of center y,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
centerY - double The center y coordinate.

getStartY

public double getStartY()
Returns the coordinate of start y.

Returns:
double The start y coordinate.

setStartY

public void setStartY(double startY)
Sets the coordinate of start y,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
startY - double The start y coordinate.

getEndY

public double getEndY()
Returns the coordinate of end y.

Returns:
double The end y coordinate.

setEndY

public void setEndY(double endY)
Sets the coordinate of end y,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
endY - double The end y coordinate.

getCenterShape

public java.awt.Shape getCenterShape()
Returns the shape of center point.

Returns:
Shape A shape (maybe null).

setCenterShape

public void setCenterShape(java.awt.Shape shape)
Sets the shape of center point,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
shape - Shape A shape (null permitted).

getCapLength

public double getCapLength()
Returns the length of the cap at the end of the error bars.

Returns:
double The length.

setCapLength

public void setCapLength(double length)
Sets the length of the cap at the end of the error bars,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
length - double The length,must be >=0.

isDrawXError

public boolean isDrawXError()
Returns whether or not the x-error bars are drawn.

Returns:
boolean A boolean.

setDrawXError

public void setDrawXError(boolean flag)
Sets whether or not the x-error bars are drawn,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

isDrawYError

public boolean isDrawYError()
Returns whether or not the y-error bars are drawn,and sends a ChartShapeChangeEvent to all registered listeners.

Returns:
boolean A boolean.

setDrawYError

public void setDrawYError(boolean flag)
Sets whether or not the y-error bars are drawn.

Parameters:
flag - boolean A boolean.

draw

public void draw(java.awt.Graphics2D g2)
Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer).

Specified by:
draw in interface IChartShape
Parameters:
g2 - Graphics2D The graphics device (such as the screen or the printer) (null not permitted).

drawSelect

protected void drawSelect(java.awt.Graphics2D g2)
Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).

Specified by:
drawSelect in class AbstractChartShape
Parameters:
g2 - Graphics2D the graphics device (such as the screen or the printer) (null not permitted).

translate

public void translate(double tx,
                      double ty)
Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners. Subsequent rendering is translated by the specified distance relative to the previous position. This is equivalent to calling transform(T), where T is an AffineTransform represented by the following matrix:
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
.

Specified by:
translate in interface IChartShape
Parameters:
tx - double The distance to translate along the x-axis.
ty - double The distance to translate along the y-axis.

getTopLeftPoint

public java.awt.geom.Point2D getTopLeftPoint()
Returns the top left corner coordinates of this shape (not consider rotation).

Specified by:
getTopLeftPoint in interface IChartShape
Returns:
Point2D The coordinate.

getLockPoint

public java.awt.geom.Point2D getLockPoint()
Returns the lock coordinates of this shape.

Specified by:
getLockPoint in interface IChartShape
Overrides:
getLockPoint in class AbstractChartShape
Returns:
Point2D The coordinate.

calculateTransformedShape

protected void calculateTransformedShape()
Calculate the transformed shape.

Specified by:
calculateTransformedShape in class AbstractChartShape

getHotspotShape

protected java.awt.Shape getHotspotShape()
Returns the hotspot shape.

Specified by:
getHotspotShape in class AbstractChartShape
Returns:
Shape The hotspot shape (maybe null).

getShapeType

public ShapeType getShapeType()
The type for describe this shape.

Specified by:
getShapeType in interface IChartShape
Returns:
ShapeType The constant value in class ShapeType.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class AbstractChartShape
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

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

Overrides:
hashCode in class AbstractChartShape
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 AbstractChartShape
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.