public class

ChartTextAnnotation

extends ChartAnnotation
java.lang.Object
   ↳ com.artfulbits.aiCharts.Annotations.ChartAnnotation
     ↳ com.artfulbits.aiCharts.Annotations.ChartTextAnnotation

Class Overview

Represents text annotation class. In order to display this annotations, instance should be added chart's annotations collection.

Summary

Public Constructors
ChartTextAnnotation(Drawable backgroundDrawable, String text, String description, Alignment horizontalAlignment, Alignment verticalAlignment)
Initializes a new instance of text annotation.
ChartTextAnnotation(Drawable backgroundDrawable, String text, String description)
Initializes a new instance of text centered annotation.
ChartTextAnnotation(Drawable backgroundDrawable, String text)
Initializes a new instance of text centered annotation with no description.
ChartTextAnnotation(String text, String description)
Initializes a new instance of text centered annotation on transparent background.
ChartTextAnnotation(String text)
Initializes a new instance of text centered annotation with no description on transparent background.
Public Methods
void draw(Canvas canvas, ChartEngine chart)
Draws annotation of specified canvas.
Drawable getBackground()
Gets the drawable used to draw annotation's background.
Paint getConnectorPaint()
Gets Paint object that is used to draw annotation's connecting line.
boolean getDrawConnector()
Gets value indicating whether connecting line should be drawn for this annotation.
Alignment getHorizontalAlignment()
Gets the horizontal alignment for this annotation.
boolean getSmartPositioning()
Sets value indicating whether smart positioning logic should be enabled for this annotation.
String getText()
Gets the annotation text.
int getTextColor()
Gets color of text of this annotation.
TextPaint getTextPaint()
Gets TextPaint object that will be used to draw annotation's text.
Alignment getVerticalAlignment()
Gets the vertical alignment for this annotation.
void setAlignment(Alignment horizontalAlignment, Alignment verticalAlignment)
Sets both the vertical and horizontal alignment for this annotation.
void setBackground(Drawable background)
Sets Drawable object that is used to draw annotation's background.
void setDrawConnector(boolean value)
Sets value indicating whether connecting line should be drawn for this annotation.
void setHorizontalAlignment(Alignment alignment)
Sets the horizontal alignment for this annotation.
void setSmartPositioning(boolean value)
Gets value indicating whether smart positioning logic should be enabled for this annotation.
void setText(String text)
void setTextColor(int color)
Sets color of text of this annotation.
void setVerticalAlignment(Alignment alignment)
Sets the vertical alignment for this annotation.
[Expand]
Inherited Methods
From class com.artfulbits.aiCharts.Annotations.ChartAnnotation
From class java.lang.Object

Public Constructors

public ChartTextAnnotation (Drawable backgroundDrawable, String text, String description, Alignment horizontalAlignment, Alignment verticalAlignment)

Initializes a new instance of text annotation.

Parameters
backgroundDrawable drawable that is used to display annotation's background.
text text for this annotation.
description text description of annotation.
horizontalAlignment horizontal annotation alignment.
verticalAlignment vertical annotation alignment.

public ChartTextAnnotation (Drawable backgroundDrawable, String text, String description)

Initializes a new instance of text centered annotation.

Parameters
backgroundDrawable drawable that is used to display annotation's background.
text text for this annotation.
description text description of annotation.

public ChartTextAnnotation (Drawable backgroundDrawable, String text)

Initializes a new instance of text centered annotation with no description.

Parameters
backgroundDrawable drawable that is used to display annotation's background.
text text for this annotation.

public ChartTextAnnotation (String text, String description)

Initializes a new instance of text centered annotation on transparent background.

Parameters
text text for this annotation.
description text description of annotation.

public ChartTextAnnotation (String text)

Initializes a new instance of text centered annotation with no description on transparent background.

Parameters
text text for this annotation.

Public Methods

public void draw (Canvas canvas, ChartEngine chart)

Draws annotation of specified canvas.

Parameters
canvas instance of canvas that is used to draw annotation.
chart instance of parent chart.

public Drawable getBackground ()

Gets the drawable used to draw annotation's background.

Returns
  • instance of Drawable object used to draw annotation's background.

public Paint getConnectorPaint ()

Gets Paint object that is used to draw annotation's connecting line.

Returns
  • instance of Paint object that is used to draw annotation's connecting line.

public boolean getDrawConnector ()

Gets value indicating whether connecting line should be drawn for this annotation.

Returns
  • true if connecting line should be drawn for this annotation, otherwise false.

public Alignment getHorizontalAlignment ()

Gets the horizontal alignment for this annotation.

Returns
  • instance of Alignment enumeration containing current alignment value.

public boolean getSmartPositioning ()

Sets value indicating whether smart positioning logic should be enabled for this annotation. If enabled, annotation will be forced to stay visible if it is about to be shown out of chart's borders.

Returns
  • true if smart positioning should be enabled, otherwise false.

public String getText ()

Gets the annotation text.

Returns
  • value of annotation text.

public int getTextColor ()

Gets color of text of this annotation.

Returns
  • integer value of annotation's text color.

public TextPaint getTextPaint ()

Gets TextPaint object that will be used to draw annotation's text.

Returns
  • instance of TextPaint object that will be used to draw annotation's text.

public Alignment getVerticalAlignment ()

Gets the vertical alignment for this annotation.

Returns
  • instance of Alignment enumeration containing current alignment value.

public void setAlignment (Alignment horizontalAlignment, Alignment verticalAlignment)

Sets both the vertical and horizontal alignment for this annotation.

Parameters
horizontalAlignment instance of Alignment enumeration containing desired alignment value.
verticalAlignment instance of Alignment enumeration containing desired alignment value.

public void setBackground (Drawable background)

Sets Drawable object that is used to draw annotation's background.

Parameters
background Drawable object that is used to draw annotation's background.

public void setDrawConnector (boolean value)

Sets value indicating whether connecting line should be drawn for this annotation.

Parameters
value true if connecting line should be drawn for this annotation, otherwise false.

public void setHorizontalAlignment (Alignment alignment)

Sets the horizontal alignment for this annotation.

Parameters
alignment instance of Alignment enumeration containing desired alignment value.

public void setSmartPositioning (boolean value)

Gets value indicating whether smart positioning logic should be enabled for this annotation. If enabled, annotation will be forced to stay visible if it is about to be shown out of chart's borders.

Parameters
value true if smart positioning should be enabled, otherwise false.

public void setText (String text)

public void setTextColor (int color)

Sets color of text of this annotation.

Parameters
color integer value of annotation's text color.

public void setVerticalAlignment (Alignment alignment)

Sets the vertical alignment for this annotation.

Parameters
alignment instance of Alignment enumeration containing desired alignment value.