Chart FX 7 for Java Server

com.softwarefx.chartfx.server.annotation
Class AnnotationText

java.lang.Object
  extended by com.softwarefx.chartfx.server.annotation.AnnotationObject
      extended by com.softwarefx.chartfx.server.annotation.AnnotationText
Direct Known Subclasses:
AnnotationBalloon

public class AnnotationText
extends AnnotationObject

Provides access to the AnnotationText object.

The AnnotationText Class allows you to add annotation text objects to your charting applications. This object is very similar to the AnnotationBalloon Class , however the balloon objects have a tip for referencing a specific point.

Below is an example of an annotation text object:

chart1.getLegendBox().setVisible(false);
chart1.importChart(FileFormat.XML, application.getRealPath("/") + "/data/samples.cfx");
com.softwarefx.chartfx.server.annotation.Annotations annot = new com.softwarefx.chartfx.server.annotation.Annotations();
chart1.getExtensions().add(annot);
chart1.getExtensions().add(annot);
com.softwarefx.chartfx.server.annotation.AnnotationText text1 = new com.softwarefx.chartfx.server.annotation.AnnotationText();
com.softwarefx.chartfx.server.annotation.AnnotationText text2 = new com.softwarefx.chartfx.server.annotation.AnnotationText();
com.softwarefx.chartfx.server.annotation.AnnotationText text3 = new com.softwarefx.chartfx.server.annotation.AnnotationText();
annot.getList().add(text1);
annot.getList().add(text2);
annot.getList().add(text3);
// Annotation Text
text1.setText("This is an Annotation Text");
text1.setTextColor(java.awt.Color.white);
text1.setColor(new java.awt.Color(0,0,0));
text1.attach(3,50);
// Non-clipped Text
text2.setText("This text is not clipped");
text2.setTextColor(java.awt.Color.red);
text2.setColor(new java.awt.Color(0,0,0,0));
text2.getBorder().setColor(new java.awt.Color(0,0,0,0));
text2.setTop(100);
text2.setLeft(240);
// Clipped Text
text3.setText("This text is clipped");
text3.setTextColor(java.awt.Color.black);
text3.setColor(new java.awt.Color(0,0,0,0));
text3.getBorder().setColor(new java.awt.Color(0,0,0,0));
text3.setTop(120);
text3.setLeft(240);


Constructor Summary
AnnotationText()
           
AnnotationText(String text)
           
 
Method Summary
 StringAlignment getAlign()
          Gets the Align.
 Font getFont()
          Gets the Font.
 StringAlignment getLineAlignment()
          Gets the LineAlignment.
 int getOrientation()
          Gets the Orientation.
 String getText()
          Gets the Text.
 Color getTextColor()
          Gets the TextColor.
 boolean isClip()
          Gets the Clip.
 boolean isWordWrap()
          Gets the WordWrap.
 void setAlign(StringAlignment value)
          Allows you to set the alignment for the selected annotation text object.
 void setClip(boolean value)
          Sets a value indicating whether or not text will be clipped by the border of an AnnotationText.
 void setFont(Font value)
          Allows you to change the font attributes for an annotation object.
 void setLineAlignment(StringAlignment value)
          Sets the vertical alignment for the lines of an annotation text object.
 void setOrientation(int value)
          Used to set the text orientation for a annotation text object.
 void setText(String value)
          Used to set the text for an annotation text object.
 void setTextColor(Color value)
          Sets the color of the text for an annotation object.
 void setWordWrap(boolean value)
          Sets a value indicating whether the text of an annotation text object will be word wrapped.
 void sizeToFit()
          Instructs Chart FX to resize a selected annotation text object to fit the configured text string.
 
Methods inherited from class com.softwarefx.chartfx.server.annotation.AnnotationObject
attach, attach, attach, detach, dispose, flip, getAnchor, getBorder, getColor, getHeight, getLeft, getLink, getObjectBounds, getPattern, getTag, getTop, getWidth, isAllowModify, isAllowMove, isPaintBefore, isPlotAreaOnly, isVisible, refresh, rotate, setAllowModify, setAllowMove, setAnchor, setBorder, setColor, setHeight, setLeft, setObjectBounds, setPaintBefore, setPattern, setPlotAreaOnly, setTag, setTop, setVisible, setWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationText

public AnnotationText()

AnnotationText

public AnnotationText(String text)
Method Detail

getAlign

public StringAlignment getAlign()

Gets the Align. For more detail see setAlign(com.softwarefx.StringAlignment).


getFont

public Font getFont()

Gets the Font. For more detail see setFont(java.awt.Font).


getLineAlignment

public StringAlignment getLineAlignment()

Gets the LineAlignment. For more detail see setLineAlignment(com.softwarefx.StringAlignment).


getOrientation

public int getOrientation()

Gets the Orientation. For more detail see setOrientation(int).


getText

public String getText()

Gets the Text. For more detail see setText(java.lang.String).


getTextColor

public Color getTextColor()

Gets the TextColor. For more detail see setTextColor(java.awt.Color).


isClip

public boolean isClip()

Gets the Clip. For more detail see setClip(boolean).


isWordWrap

public boolean isWordWrap()

Gets the WordWrap. For more detail see setWordWrap(boolean).


setAlign

public void setAlign(StringAlignment value)

Allows you to set the alignment for the selected annotation text object.

Remarks:
  • You can align the text in the text object using this property. You can adjust the alignment for the entire text line using the setLineAlignment(com.softwarefx.StringAlignment) property.

  • The text for the object can be set using the setText(java.lang.String) property. You can also set the color using the setTextColor(java.awt.Color) property.

  • The text orientation may be controlled by utilizing the setOrientation(int) property.

  • To set the font associated with the text object, please refer to the setFont(java.awt.Font) property.

  • The sizeToFit() method instructs Chart FX to calculate the best fit for the selected Text Object.

  • See Also:
    setLineAlignment(com.softwarefx.StringAlignment), setText(java.lang.String), setTextColor(java.awt.Color), setOrientation(int), setFont(java.awt.Font), sizeToFit(), AnnotationObject

    setClip

    public void setClip(boolean value)

    Sets a value indicating whether or not text will be clipped by the border of an AnnotationText.

    Remarks:
  • When set to False, all the configured text will be displayed wrapping outside of the configured dimensions of an annotation object. If a border is visible, the text may overlap causing undesirable results. When set to True, the Text will be clipped and not displayed outside the bounds of the configured AnnotationText object.

  • See Also:
    AnnotationObject.setHeight(int), AnnotationObject.setWidth(int), AnnotationObject.attach(double, double), AnnotationObject

    setFont

    public void setFont(Font value)

    Allows you to change the font attributes for an annotation object.

    Remarks:
  • When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.

  • You can set the text for the text object using the setText(java.lang.String) property. You can modify the text color using the setTextColor(java.awt.Color) property.

  • For more information regarding the Font type, please refer to the Java API Documentation.

  • See Also:
    setText(java.lang.String), setTextColor(java.awt.Color)

    setLineAlignment

    public void setLineAlignment(StringAlignment value)

    Sets the vertical alignment for the lines of an annotation text object.

    Remarks:
  • The horizontal text alignment may be modified using the setAlign(com.softwarefx.StringAlignment) property.

  • You can set the text for the text object using the setText(java.lang.String) property. You can modify the text color using the setTextColor(java.awt.Color) property.

  • The sizeToFit() method instructs Chart FX to calculate the best fit for the selected Text Object.

  • The text orientation may be controlled by utilizing the setOrientation(int) property.

  • To set the font associated with the text object, please refer to the setFont(java.awt.Font) property.

  • See Also:
    setAlign(com.softwarefx.StringAlignment), setText(java.lang.String), setTextColor(java.awt.Color), setOrientation(int), setFont(java.awt.Font), sizeToFit(), AnnotationObject

    setOrientation

    public void setOrientation(int value)

    Used to set the text orientation for a annotation text object.

    Remarks:
  • The text orientation and settings for this property are as follows:

    0 = Sets the text orientation Left to Right

    1 = Sets the text orientation Bottom to Top

    2 = Sets the text orientation Right To Left

    3 = Sets the text orientation Top to Bottom

  • When you AnnotationObject.rotate(boolean) a Text Object this setting will be changed accordingly to the rotation angle selected for the Text object.

  • See Also:
    AnnotationObject.rotate(boolean)

    setText

    public void setText(String value)

    Used to set the text for an annotation text object.

    Remarks:
  • The setTextColor(java.awt.Color) property allows you to change the text color of the annotation text object.

  • The horizontal text alignment may be modified using the setAlign(com.softwarefx.StringAlignment) property. You can adjust the alignment for the entire text line using the setLineAlignment(com.softwarefx.StringAlignment) property.

  • The text orientation may be controlled by utilizing the setOrientation(int) property.

  • To set the font associated with the text object, please refer to the setFont(java.awt.Font) property.

  • See Also:
    setTextColor(java.awt.Color), setAlign(com.softwarefx.StringAlignment), setLineAlignment(com.softwarefx.StringAlignment), setOrientation(int), setFont(java.awt.Font), AnnotationObject

    setTextColor

    public void setTextColor(Color value)

    Sets the color of the text for an annotation object.

    Remarks:
  • You can set the text for an annotation text object using the setText(java.lang.String) property.

  • The horizontal text alignment may be modified using the setAlign(com.softwarefx.StringAlignment) property. You can adjust the alignment for the entire text line using the setLineAlignment(com.softwarefx.StringAlignment) property.

  • To set the font associated with the text object, please refer to the setFont(java.awt.Font) property.

  • The text orientation may be controlled by utilizing the setOrientation(int) property.

  • For more information regarding the Color type, please refer to the Java API Documentation.

  • See Also:
    setText(java.lang.String), setAlign(com.softwarefx.StringAlignment), setLineAlignment(com.softwarefx.StringAlignment), setFont(java.awt.Font), setOrientation(int), AnnotationObject

    setWordWrap

    public void setWordWrap(boolean value)

    Sets a value indicating whether the text of an annotation text object will be word wrapped.

    Remarks:
  • The WordWrap property will allow developers to select whether text of an AnnotationText object will wrap or be displayed as one line.

  • See Also:
    Annotations

    sizeToFit

    public void sizeToFit()

    Instructs Chart FX to resize a selected annotation text object to fit the configured text string.

    Remarks:
  • Calling this method will instruct Chart FX to recalculate the configured AnnotationObject.setHeight(int) and AnnotationObject.setWidth(int).

  • You can set the text for the annotation text object using the setText(java.lang.String) property. The text color may be modified using the setTextColor(java.awt.Color) property.

  • See Also:
    AnnotationObject.setHeight(int), AnnotationObject.setWidth(int), setText(java.lang.String), setTextColor(java.awt.Color), AnnotationObject

    http://www.softwarefx.com

    2008 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.