Chart FX for Java 6.5

SoftwareFX.ChartFX.Annotation
Class AnnotationPolygon

java.lang.Object
  extended by SoftwareFX.ChartFX.Annotation.AnnotationObject
      extended by SoftwareFX.ChartFX.Annotation.AnnotationPolygon

public final class AnnotationPolygon
extends AnnotationObject

Provides access to the AnnotationPolygon object.

The AnnotationPolygon class allows you to create polygon annotation objects in your charts. The supported members allow you to configure the vertices for the object as well as many other attributes.

Below is an example of an annotation polygon object:

SoftwareFX.ChartFX.Annotation.AnnotationX annot = new SoftwareFX.ChartFX.Annotation.AnnotationX();
chart1.getExtensions().add(annot);
SoftwareFX.ChartFX.Annotation.AnnotationPolygon poly = new SoftwareFX.ChartFX.Annotation.AnnotationPolygon();
annot.getList().add(poly);
java.awt.Point[] p = new java.awt.Point[4];
p[0] = new java.awt.Point(250,50);
p[1] = new java.awt.Point(320,150);
p[2] = new java.awt.Point(300,250);
p[3] = new java.awt.Point(200,150);
poly.setColor(java.awt.Color.RED);
poly.setVertices(p);
poly.setClosed(true);

Note: The AnnotationObject.attach(int, double, int, double) method may NOT be used when positioning the AnnotationPolygon object within the chart area. The AnnotationPolygon is the only annotation object that does not support the Attach method.


Constructor Summary
AnnotationPolygon()
           
AnnotationPolygon(java.awt.Point points)
           
 
Method Summary
 int getNumVertex()
          Allows you to read the number of vertices associated with an annotation polygon object.
 java.awt.Point[] getVertices()
          Gets the Vertices.
 boolean isClosed()
          Gets the Closed.
 void recalcBounds()
          Instruct Chart FX to recalculate the bounds for an annotation polygon object.
 void setClosed(boolean value)
          Instructs Chart FX to draw a line from the beginning vertex to the ending vertex.
 void setVertices(java.awt.Point[] value)
          Used to set the vertices for an annotation polygon object.
 
Methods inherited from class SoftwareFX.ChartFX.Annotation.AnnotationObject
attach, attach, attach, detach, flip, getAnchor, getBorder, getColor, getHeight, getLeft, getLink, getObjectBounds, getPattern, getTag, getTop, getURL, getURLTarget, getWidth, isAllowModify, isAllowMove, isDrawingArea, isPaintBefore, isVisible, refresh, rotate, setAllowModify, setAllowMove, setAnchor, setBorder, setColor, setDrawingArea, setHeight, setLeft, setObjectBounds, setPaintBefore, setPattern, setTag, setTop, setURL, setURLTarget, setVisible, setWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationPolygon

public AnnotationPolygon()

AnnotationPolygon

public AnnotationPolygon(java.awt.Point points)
Method Detail

getNumVertex

public int getNumVertex()

Allows you to read the number of vertices associated with an annotation polygon object.

Remarks:
  • This property is Read-Only.

  • You can set multiple vertices for polygon using the setVertices(java.awt.Point[]) property.

  • See Also:
    setVertices(java.awt.Point[]), AnnotationObject

    getVertices

    public java.awt.Point[] getVertices()

    Gets the Vertices. For more detail see setVertices(java.awt.Point[]).


    isClosed

    public boolean isClosed()

    Gets the Closed. For more detail see setClosed(boolean).


    recalcBounds

    public void recalcBounds()

    Instruct Chart FX to recalculate the bounds for an annotation polygon object.

    Remarks:
  • This method should be invoked every time the vertex of a polygon object is modified. Recalculating the bounds will instruct Chart FX to redraw the polygon object with the new attributes.

  • See Also:
    setVertices(java.awt.Point[]), AnnotationObject

    setClosed

    public void setClosed(boolean value)

    Instructs Chart FX to draw a line from the beginning vertex to the ending vertex.

    Remarks:
  • By default this property is set to True. This means that when you set the vertices for a polygon, Chart FX will draw a line from the beginning vertex and ending vertex to make an enclosed shape.

  • Setting this property to False will cause the configured polygon to have an open side if the vertices have not be set to meet manually.

  • If your polygon object has an open side, the object will not accept its configured AnnotationObject.setColor(java.awt.Color).

  • See Also:
    AnnotationObject.setColor(java.awt.Color), AnnotationObject

    setVertices

    public void setVertices(java.awt.Point[] value)

    Used to set the vertices for an annotation polygon object.

    Remarks:
  • When configuring the vertices for an annotation polygon, you will need to create an array of points. Each of the points (X,Y) will represent a vertex for the polygon you are creating. The AnnotationObject.attach(int, double, int, double) method may NOT be used when positioning the AnnotationPolygon object. The AnnotationPolygon is the only annotation object that does not support the Attach method.

  • A polygon is usually a closed shape with three or more straight sides. For example, a triangle is a polygon with three sides, a rectangle is a polygon with four sides, and a pentagon is a polygon with five sides.

    The setClosed(boolean) property allows you to specify that a selected polygon object will be an open or closed geometric shape. If a selected polygon object is not closed, you will not be able to color in inside area using the AnnotationObject.setColor(java.awt.Color) property.

  • You may read the number of vertices of a selected polygon object using the getNumVertex() property.

  • See Also:
    setClosed(boolean), AnnotationObject.setColor(java.awt.Color), getNumVertex(), recalcBounds(), AnnotationObject

    http://www.softwarefx.com

    2007 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
    All other names are trademarks or registered trademarks of their respective owners.