com.ijchart.xychart.shape
Class LineChartShape

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

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

Title: IJChart

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

Draw a line 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
 
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
LineChartShape(double x1, double y1, double x2, double y2)
           Draw a line from point (x1,y1) to point (x2,y2).
LineChartShape(java.awt.geom.Line2D line)
           Draw a line.
LineChartShape(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           Draw a line from point (p1) to point (p2).
 
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.
protected  java.awt.Shape getHotspotShape()
           Returns the hotspot shape.
 java.awt.geom.Point2D getLockPoint()
           Returns the lock coordinates of this shape.
 java.awt.geom.Point2D getPoint1()
           Returns the first point coordinate.
 java.awt.geom.Point2D getPoint2()
           Returns the second point coordinate.
 ShapeType getShapeType()
           The type for describe this shape.
protected  double getTooltipShapeRotate()
           Returns the angle of rotation of the tooltip shape.
protected  java.awt.geom.Point2D getTooltipShapeTranslatePoint()
           Returns the translate point of tooltip shape.
 java.awt.geom.Point2D getTopLeftPoint()
           Returns the top left corner coordinates of this shape (not consider rotation).
 double getX1()
           Returns the first point's x coordinate.
 double getX2()
           Returns the second point's x coordinate.
 double getY1()
           Returns the first point's y coordinate.
 double getY2()
           Returns the second point's y coordinate.
 int hashCode()
           Returns a hash code value for the object.
 void setPoint1(double x, double y)
           Sets the first point coordinate and sends a ChartShapeChangeEvent to all registered listeners.
 void setPoint1(java.awt.geom.Point2D p)
           Sets the first point coordinate,and sends a ChartShapeChangeEvent to all registered listeners.
 void setPoint2(double x, double y)
           Sets the second point coordinate,and sends a ChartShapeChangeEvent to all registered listeners.
 void setPoint2(java.awt.geom.Point2D p)
           Sets the second point coordinate and sends a ChartShapeChangeEvent to all registered listeners.
 void setX1(double x1)
           Sets the first point's x coordinate,and sends a ChartShapeChangeEvent to all registered listeners.
 void setX2(double x2)
           Sets the second point's x coordinate,and sends a ChartShapeChangeEvent to all registered listeners.
 void setY1(double y1)
           Sets the first point's y coordinate,and sends a ChartShapeChangeEvent to all registered listeners.
 void setY2(double y2)
           Sets the second point's y coordinate,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, 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
 

Constructor Detail

LineChartShape

public LineChartShape(double x1,
                      double y1,
                      double x2,
                      double y2)
Draw a line from point (x1,y1) to point (x2,y2).

Parameters:
x1 - double The first point's x coordinate.
y1 - double The first point's y coordinate.
x2 - double The second point's x coordinate.
y2 - double The second point's y coordinate.

LineChartShape

public LineChartShape(java.awt.geom.Point2D p1,
                      java.awt.geom.Point2D p2)
Draw a line from point (p1) to point (p2).

Parameters:
p1 - Point2D The first point (null not permitted).
p2 - Point2D The second point (null not permitted).

LineChartShape

public LineChartShape(java.awt.geom.Line2D line)
Draw a line.

Parameters:
line - Line2D The line (null not permitted).
Method Detail

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

getTooltipShapeTranslatePoint

protected java.awt.geom.Point2D getTooltipShapeTranslatePoint()
Returns the translate point of tooltip shape.

Overrides:
getTooltipShapeTranslatePoint in class AbstractChartShape
Returns:
Point2D The translate point (null permitted).

getTooltipShapeRotate

protected double getTooltipShapeRotate()
Returns the angle of rotation of the tooltip shape.

Overrides:
getTooltipShapeRotate in class AbstractChartShape
Returns:
double The angle of rotation (in radians).

setX1

public void setX1(double x1)
Sets the first point's x coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
x1 - double

getX1

public double getX1()
Returns the first point's x coordinate.

Returns:
double

setY1

public void setY1(double y1)
Sets the first point's y coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
y1 - double

getY1

public double getY1()
Returns the first point's y coordinate.

Returns:
double

setX2

public void setX2(double x2)
Sets the second point's x coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
x2 - double

getX2

public double getX2()
Returns the second point's x coordinate.

Returns:
double

setY2

public void setY2(double y2)
Sets the second point's y coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
y2 - double

getY2

public double getY2()
Returns the second point's y coordinate.

Returns:
double

setPoint1

public void setPoint1(double x,
                      double y)
Sets the first point coordinate and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
x - double The first point's x coordinate.
y - double The first point's y coordinate.

setPoint2

public void setPoint2(double x,
                      double y)
Sets the second point coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
x - double The second point's x coordinate.
y - double The second point's y coordinate.

setPoint1

public void setPoint1(java.awt.geom.Point2D p)
Sets the first point coordinate,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
p - Point2D The first point coordinate (null not permitted).

getPoint1

public java.awt.geom.Point2D getPoint1()
Returns the first point coordinate.

Returns:
Point2D Returns the first point coordinate (never null).

setPoint2

public void setPoint2(java.awt.geom.Point2D p)
Sets the second point coordinate and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
p - Point2D The second point coordinate (null not permitted).

getPoint2

public java.awt.geom.Point2D getPoint2()
Returns the second point coordinate.

Returns:
Point2D Returns the second point coordinate (never null).

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.