com.ijchart.xychart.shape
Class BoxAndWhiskerChartShape

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

public class BoxAndWhiskerChartShape
extends AbstractRectangleTextChartShape
implements java.io.Serializable, java.lang.Cloneable

Title: IJChart

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

Draw a BoxAndWhiskerChartShape 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 java.awt.Paint DEFAULT_ARTIFACT_PAINT
           The default color used to paint the median line and average marker.
 
Fields inherited from class com.ijchart.xychart.shape.AbstractRectangleTextChartShape
DEFAULT_DRAW_AUTO_WRAP, DEFAULT_FORCE_INSIDE_TEXT_NO_WRAP, DEFAULT_FORCE_SHOW_ALL, DEFAULT_TEXT_MAX_SHOW_LINE
 
Fields inherited from class com.ijchart.xychart.shape.AbstractTextChartShape
DEFAULT_TEXT_DIRECTION, DEFAULT_TEXT_HORIZONTAL_ALIGNMENT, DEFAULT_TEXT_POSITION, DEFAULT_TEXT_VERTICAL_ALIGNMENT
 
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
BoxAndWhiskerChartShape(double leftX, double bottomY, double width, double height, double topLineLength, double bottomLineLength, java.awt.geom.Ellipse2D ellipse, double lineY, java.awt.Paint artifactPaint)
           Draw a I-shaped chart shape.
BoxAndWhiskerChartShape(double leftX, double bottomY, double width, double height, double topLineLength, double bottomLineLength, java.awt.geom.Ellipse2D ellipse, double lineY, java.awt.Paint artifactPaint, java.awt.geom.Ellipse2D[] averageValueEllipse, java.awt.Shape highFarBorderTriangle, java.awt.Shape lawFarBorder)
           Draw a I-shaped chart shape.
BoxAndWhiskerChartShape(double leftX, double bottomY, double width, double height, double topLineLength, double bottomLineLength, java.awt.geom.Ellipse2D ellipse, double lineY, java.awt.Paint artifactPaint, java.lang.String text)
           Draw a I-shaped chart shape.
BoxAndWhiskerChartShape(double leftX, double bottomY, double width, double height, double topLineLength, double bottomLineLength, java.awt.geom.Ellipse2D ellipse, double lineY, java.awt.Paint artifactPaint, java.lang.String text, java.awt.geom.Ellipse2D[] averageValueEllipse, java.awt.Shape highFarBorderTriangle, java.awt.Shape lowFarBorder)
           Draw a I-shaped chart shape.
 
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.
 java.awt.Paint getArtifactPaint()
           Returns the color used to paint the median line and average marker.
 java.awt.geom.Ellipse2D[] getAverageValueEllipse()
           Returns the ellipses for represent the average value.
 java.awt.geom.Ellipse2D getAvgEllipse()
           Returns the ellipse.
 double getBottomLineLength()
           Returns the length of bottom line.
 double getBottomY()
           Returns the y coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.
 double getHeight()
           Returns the height of I-shaped shape.
 java.awt.Shape getHighFarBorderTriangle()
           Returns a triangle to indicate the presence of far-out values.
protected  java.awt.Shape getHotspotShape()
           Returns the hotspot shape.
 double getLeftX()
           Returns the x coordinate of left-hand corner.
 double getLineY()
           Returns the y-coordinate of line.
 java.awt.geom.Point2D getLockPoint()
           Returns the lock coordinates of this shape.
 java.awt.Shape getLowFarBorderTriangle()
           Returns a triangle to indicate the presence of low-out values.
 ShapeType getShapeType()
           The type for describe this shape.
 java.awt.geom.Point2D getTopLeftPoint()
           Returns the top left corner coordinates of this shape (not consider rotation).
 double getTopLineLength()
           Returns the length of top line.
 double getWidth()
           Sets the width of I-shaped shape.
 int hashCode()
           Returns a hash code value for the object.
 void setArtifactPaint(java.awt.Paint paint)
           Sets the color used to paint the median line and average marker,and sends a ChartShapeChangeEvent to all registered listeners.
 void setAverageValueEllipse(java.awt.geom.Ellipse2D[] ellipses)
           Sets the ellipses for represent the average value,and sends a ChartShapeChangeEvent to all registered listeners.
 void setAvgEllipse(java.awt.geom.Ellipse2D ellipse)
           Sets the ellipse,and sends a ChartShapeChangeEvent to all registered listeners.
 void setBottomLineLength(double length)
           Sets the length of bottom line,and sends a ChartShapeChangeEvent to all registered listeners.
 void setBottomY(double bottomY)
           Sets the y coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.
 void setHeight(double height)
           Sets the height of I-shaped shape,and sends a ChartShapeChangeEvent to all registered listeners.
 void setHighFarBorderTriangle(java.awt.Shape lines)
           Sets a triangle to indicate the presence of far-out values,and sends a ChartShapeChangeEvent to all registered listeners.
 void setLeftX(double leftX)
           Sets the x coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.
 void setLineY(double lineY)
           Sets the y-coordinate of line,and sends a ChartShapeChangeEvent to all registered listeners.
 void setLowFarBorderTriangle(java.awt.Shape lines)
           Sets a triangle to indicate the presence of far-out values,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTopLineLength(double length)
           Sets the length of top line,and sends a ChartShapeChangeEvent to all registered listeners.
 void setWidth(double width)
           Sets the width of I-shaped shape,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.AbstractRectangleTextChartShape
drawText, drawTextWithTrimMarginRect, getDrawArea, getTextMaxShowLine, getTooltipShapeTranslatePoint, isAutoWrap, isForceInsideTextNoWrap, isForceShowAll, setAutoWrap, setDrawArea, setForceInsideTextNoWrap, setForceShowAllText, setTextMaxShowLine, splitString
 
Methods inherited from class com.ijchart.xychart.shape.AbstractTextChartShape
getText, getTextDirection, getTextFont, getTextHorizontalAlign, getTextPaint, getTextPosition, getTextVerticalAlign, isDrawText, setDrawText, setText, setTextDirection, setTextFont, setTextHorizontalAlign, setTextPaint, setTextPosition, setTextVerticalAlign
 
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, 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_ARTIFACT_PAINT

public static final java.awt.Paint DEFAULT_ARTIFACT_PAINT
The default color used to paint the median line and average marker.

Constructor Detail

BoxAndWhiskerChartShape

public BoxAndWhiskerChartShape(double leftX,
                               double bottomY,
                               double width,
                               double height,
                               double topLineLength,
                               double bottomLineLength,
                               java.awt.geom.Ellipse2D ellipse,
                               double lineY,
                               java.awt.Paint artifactPaint)
Draw a I-shaped chart shape.

Parameters:
leftX - double The x coordinate of left-hand corner.
bottomY - double The y coordinate of left-hand corner.
width - double The width of I-shaped shape.
height - double The height of I-shaped shape.
topLineLength - double The length of top line.
bottomLineLength - double The length of bottom line.
ellipse - Ellipse2D The ellipse (null permitted).
lineY - double The y-coordinate of line,if this value is Double.Nan,no line will be draw.
artifactPaint - The color used to paint the median line and average marker (null permitted).

BoxAndWhiskerChartShape

public BoxAndWhiskerChartShape(double leftX,
                               double bottomY,
                               double width,
                               double height,
                               double topLineLength,
                               double bottomLineLength,
                               java.awt.geom.Ellipse2D ellipse,
                               double lineY,
                               java.awt.Paint artifactPaint,
                               java.lang.String text)
Draw a I-shaped chart shape.

Parameters:
leftX - double The x coordinate of left-hand corner.
bottomY - double The y coordinate of left-hand corner.
width - double The width of I-shaped shape.
height - double The height of I-shaped shape.
topLineLength - double The length of top line.
bottomLineLength - double The length of bottom line.
ellipse - Ellipse2D The ellipse (null permitted).
lineY - double The y-coordinate of line,if this value is Double.Nan,no line will be draw.
artifactPaint - The color used to paint the median line and average marker (null permitted).
text - String The text (null permitted).

BoxAndWhiskerChartShape

public BoxAndWhiskerChartShape(double leftX,
                               double bottomY,
                               double width,
                               double height,
                               double topLineLength,
                               double bottomLineLength,
                               java.awt.geom.Ellipse2D ellipse,
                               double lineY,
                               java.awt.Paint artifactPaint,
                               java.awt.geom.Ellipse2D[] averageValueEllipse,
                               java.awt.Shape highFarBorderTriangle,
                               java.awt.Shape lawFarBorder)
Draw a I-shaped chart shape.

Parameters:
leftX - double The x coordinate of left-hand corner.
bottomY - double The y coordinate of left-hand corner.
width - double The width of I-shaped shape.
height - double The height of I-shaped shape.
topLineLength - double The length of top line.
bottomLineLength - double The length of bottom line.
ellipse - Ellipse2D The ellipse (null permitted).
lineY - double The y-coordinate of line,if this value is Double.Nan,no line will be draw.
artifactPaint - The color used to paint the median line and average marker (null permitted).
averageValueEllipse - Ellipse2D[] Draws one or two circles to represent the average value of a outlier or more than one outlier (null permitted).
highFarBorderTriangle - Shape Draws a triangle to indicate the presence of far-out values (null permitted).
lawFarBorder - Shape Draws a triangle to indicate the presence of low-out values (null permitted).

BoxAndWhiskerChartShape

public BoxAndWhiskerChartShape(double leftX,
                               double bottomY,
                               double width,
                               double height,
                               double topLineLength,
                               double bottomLineLength,
                               java.awt.geom.Ellipse2D ellipse,
                               double lineY,
                               java.awt.Paint artifactPaint,
                               java.lang.String text,
                               java.awt.geom.Ellipse2D[] averageValueEllipse,
                               java.awt.Shape highFarBorderTriangle,
                               java.awt.Shape lowFarBorder)
Draw a I-shaped chart shape.

Parameters:
leftX - double The x coordinate of left-hand corner.
bottomY - double The y coordinate of left-hand corner.
width - double The width of I-shaped shape.
height - double The height of I-shaped shape.
topLineLength - double The length of top line.
bottomLineLength - double The length of bottom line.
ellipse - Ellipse2D The ellipse (null permitted).
lineY - double The y-coordinate of line,if this value is Double.Nan,no line will be draw.
artifactPaint - The color used to paint the median line and average marker (null permitted).
text - String The text (null permitted).
averageValueEllipse - Ellipse2D[] Draws one or two circles to represent the average value of a outlier or more than one outlier (null permitted).
highFarBorderTriangle - Shape Draws a triangle to indicate the presence of far-out values (null permitted).
lowFarBorder - Shape Draws a triangle to indicate the presence of low-out values (null permitted).
Method Detail

getLeftX

public double getLeftX()
Returns the x coordinate of left-hand corner.

Returns:
double

setLeftX

public void setLeftX(double leftX)
Sets the x coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
leftX - double

getBottomY

public double getBottomY()
Returns the y coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.

Returns:
double

setBottomY

public void setBottomY(double bottomY)
Sets the y coordinate of left-hand corner,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
bottomY - double

getWidth

public double getWidth()
Sets the width of I-shaped shape.

Returns:
double

setWidth

public void setWidth(double width)
Sets the width of I-shaped shape,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
width - double

getHeight

public double getHeight()
Returns the height of I-shaped shape.

Returns:
double

setHeight

public void setHeight(double height)
Sets the height of I-shaped shape,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
height - double

getTopLineLength

public double getTopLineLength()
Returns the length of top line.

Returns:
double The length.

setTopLineLength

public void setTopLineLength(double length)
Sets the length of top line,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
length - double The length.

getBottomLineLength

public double getBottomLineLength()
Returns the length of bottom line.

Returns:
double The length.

setBottomLineLength

public void setBottomLineLength(double length)
Sets the length of bottom line,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
length - double The length.

getAvgEllipse

public java.awt.geom.Ellipse2D getAvgEllipse()
Returns the ellipse.

Returns:
Ellipse2D The ellipse.

setAvgEllipse

public void setAvgEllipse(java.awt.geom.Ellipse2D ellipse)
Sets the ellipse,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
ellipse - Ellipse2D The ellipse (null permitted).

getLineY

public double getLineY()
Returns the y-coordinate of line.

Returns:
double The y-coordinate of line.

setLineY

public void setLineY(double lineY)
Sets the y-coordinate of line,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
lineY - double The y-coordinate of line.

getArtifactPaint

public java.awt.Paint getArtifactPaint()
Returns the color used to paint the median line and average marker.

Returns:
Paint The paint (never null).

setArtifactPaint

public void setArtifactPaint(java.awt.Paint paint)
Sets the color used to paint the median line and average marker,and sends a ChartShapeChangeEvent to all registered listeners.

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

getAverageValueEllipse

public java.awt.geom.Ellipse2D[] getAverageValueEllipse()
Returns the ellipses for represent the average value.

Returns:
Ellipse2D[] The ellipses,maybe null.

setAverageValueEllipse

public void setAverageValueEllipse(java.awt.geom.Ellipse2D[] ellipses)
Sets the ellipses for represent the average value,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
ellipses - Ellipse2D[] The ellipses,the length of ellipses must be less or equal to 2 (null permitted).

getHighFarBorderTriangle

public java.awt.Shape getHighFarBorderTriangle()
Returns a triangle to indicate the presence of far-out values.

Returns:
Shape The lines (maybe null).

setHighFarBorderTriangle

public void setHighFarBorderTriangle(java.awt.Shape lines)
Sets a triangle to indicate the presence of far-out values,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
lines - Shape The lines (null permitted).

getLowFarBorderTriangle

public java.awt.Shape getLowFarBorderTriangle()
Returns a triangle to indicate the presence of low-out values.

Returns:
Shape The lines (maybe null).

setLowFarBorderTriangle

public void setLowFarBorderTriangle(java.awt.Shape lines)
Sets a triangle to indicate the presence of far-out values,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
lines - Shape The lines (null permitted).

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
Overrides:
translate in class AbstractRectangleTextChartShape
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
Overrides:
getTopLeftPoint in class AbstractRectangleTextChartShape
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 AbstractRectangleTextChartShape
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 AbstractRectangleTextChartShape
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 AbstractRectangleTextChartShape
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 AbstractRectangleTextChartShape
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 AbstractRectangleTextChartShape
Returns:
a string representation of the object.