public class

AnnotationsManager

extends Object
java.lang.Object
   ↳ com.shinobicontrols.charts.AnnotationsManager

Class Overview

The annotations manager handles the creation, addition and removal of Annotation objects on behalf of the ShinobiChart.

Annotations are a shinobicharts Premium Edition-only feature. Attempting to add annotations with the Standard Edition will result in an java.lang.UnsupportedOperationException being thrown.

Summary

Public Methods
Annotation addBoxAnnotation(Range<?> xRange, Range<?> yRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation that is a box spanning the given ranges on the X and Y axes.
Annotation addHorizontalBandAnnotation(Range<?> yRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation that is a horizontal band stretching across the whole of the width of the plot area and the given range on the Y axis.
Annotation addHorizontalLineAnnotation(Object yValue, float thickness, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation that is a horizontal line stretching across the whole of the width of the plot area.
Annotation addTextAnnotation(String text, Object xValue, Object yValue, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation containing the given text at the specified position on the chart's plot area.
Annotation addVerticalBandAnnotation(Range<?> xRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation that is a vertical band stretching across the whole of the height of the plot area and the given range on the X axis.
Annotation addVerticalLineAnnotation(Object xValue, float thickness, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation that is a vertical line stretching across the whole of the height of the plot area.
Annotation addViewAnnotation(View view, Object xValue, Object yValue, Axis<?, ?> xAxis, Axis<?, ?> yAxis)
Creates and adds an Annotation containing the given android.view.View.
List<Annotation> getAnnotations()
Returns a list of all the Annotation objects currently on the chart in the order they were added.
void removeAllAnnotations(Axis<?, ?> axis)
Removes all the Annotation objects currently on the chart that are associated with axis.
void removeAllAnnotations()
Removes all the Annotation objects currently on the chart.
void removeAnnotation(Annotation annotation)
Removes the given Annotation from the chart.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public Annotation addBoxAnnotation (Range<?> xRange, Range<?> yRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation that is a box spanning the given ranges on the X and Y axes. Its color is determined by the default background color of the AnnotationStyle in the current theme.

xRange and yRange, and thus their minimum and maximum values, must be of an appropriate type for the annotation's respective X and Y axes otherwise a java.lang.ClassCastException will be thrown when the chart is drawn. The annotation is given the specified X and Y axes.

The annotation will be given a basic android.view.View object as its view.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it continues to span the given X and Y data ranges thus zoom gestures will cause the box to expand/shrink accordingly.

Parameters
xRange the range on the X axis, in terms of data, that the band spans
yRange the range on the Y axis, in terms of data, that the band spans
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addHorizontalBandAnnotation (Range<?> yRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation that is a horizontal band stretching across the whole of the width of the plot area and the given range on the Y axis. Its color is determined by the default background color of the AnnotationStyle in the current theme.

yRange, and thus its minimum and maximum, must be of an appropriate type for the annotation's Y axis otherwise a java.lang.ClassCastException will be thrown when the chart is drawn. The annotation is given the specified X and Y axes.

The annotation will be given a basic android.view.View object as its view.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it continues to span the given Y data range thus zoom gestures will cause the band to expand/shrink accordingly.

Parameters
yRange the range on the Y axis, in terms of data, that the band spans
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addHorizontalLineAnnotation (Object yValue, float thickness, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation that is a horizontal line stretching across the whole of the width of the plot area. The line is centered on the specified Y axis data value and its thickness is determined by thickness. Its color is determined by the default background color of the AnnotationStyle in the current theme.

yValue must be of an appropriate type for the annotation's Y axis otherwise a java.lang.ClassCastException will be thrown when the chart is drawn. The annotation is given the specified X and Y axes.

The annotation will be given a basic android.view.View object as its view.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it remains centered on the given Y data value. Zoom gestures will have no effect on the thickness of the line.

Parameters
yValue the value on the Y axis, in terms of data, that the line centers on
thickness the thickness of the line, in device independent pixels
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addTextAnnotation (String text, Object xValue, Object yValue, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation containing the given text at the specified position on the chart's plot area. The look and feel of the annotation is determined by the default settings of the AnnotationStyle in the current theme.

The annotation will be given a android.widget.TextView to hold the text with its center at the pixel position represented by the given X and Y data values. xValue and yValue must be of an appropriate type for the annotation's respective X and Y axes otherwise a java.lang.ClassCastException will be thrown when the chart is drawn.

The annotation is given the specified X and Y axes.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it remains fixed to its X and Y data values.

Parameters
text the text to display in the annotation
xValue the position of the center of the annotation, in terms of data on the X axis the annotation is associated with
yValue the position of the center of the annotation, in terms of data on the Y axis the annotation is associated with
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addVerticalBandAnnotation (Range<?> xRange, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation that is a vertical band stretching across the whole of the height of the plot area and the given range on the X axis. Its color is determined by the default background color of the AnnotationStyle in the current theme.

xRange, and thus its minimum and maximum, must be of an appropriate type for the annotation's X axis otherwise a java.lang.ClassCastException will be thrown when the chart is drawn. The annotation is given the specified X and Y axes.

The annotation will be given a basic android.view.View object as its view.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it continues to span the given X data range thus zoom gestures will cause the band to expand/shrink accordingly.

Parameters
xRange the range on the X axis, in terms of data, that the band spans
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addVerticalLineAnnotation (Object xValue, float thickness, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation that is a vertical line stretching across the whole of the height of the plot area. The line is centered on the specified X axis data value and its thickness is determined by thickness. Its color is determined by the default background color of the AnnotationStyle in the current theme.

xValue must be of an appropriate type for the annotation's X axis otherwise a java.lang.ClassCastException will be thrown when the chart is drawn. The annotation is given the specified X and Y axes.

The annotation will be given a basic android.view.View object as its view.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it remains centered on the given X data value. Zoom gestures will have no effect on the thickness of the line.

Parameters
xValue the value on the X axis, in terms of data, that the line centers on
thickness the thickness of the line, in device independent pixels
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public Annotation addViewAnnotation (View view, Object xValue, Object yValue, Axis<?, ?> xAxis, Axis<?, ?> yAxis)

Creates and adds an Annotation containing the given android.view.View. All styling options are ignored for annotations created using this method; customization should be performed on the view directly.

The annotation will be placed on the chart's plot area with its center at the pixel position represented by the given X and Y data values. xValue and yValue must be of an appropriate type for the annotation's respective X and Y axes otherwise a java.lang.ClassCastException will be thrown when the chart is drawn.

The annotation is given the specified X and Y axes.

As pan and zoom gestures are performed on the chart, the position of the annotation will be updated to ensure it remains fixed to its X and Y data values.

Parameters
view the view to use in the annotation
xValue the position of the center of the annotation, in terms of data on the X axis the annotation is associated with
yValue the position of the center of the annotation, in terms of data on the Y axis the annotation is associated with
xAxis the X axis the annotation will be associated with
yAxis the Y axis the annotation will be associated with
Returns
  • the annotation that has been added to the chart

public List<Annotation> getAnnotations ()

Returns a list of all the Annotation objects currently on the chart in the order they were added. If there are none this method will return an empty list.

This list is read-only. Attempts to add, remove or replace the contents of the list will result in an java.lang.UnsupportedOperationException being thrown. However, it is possible to modify the elements in the list.

Returns
  • an unmodifiable list of all the annotations on the chart

public void removeAllAnnotations (Axis<?, ?> axis)

Removes all the Annotation objects currently on the chart that are associated with axis.

Parameters
axis the axis for which any associated annotations are removed from the chart

public void removeAllAnnotations ()

Removes all the Annotation objects currently on the chart.

public void removeAnnotation (Annotation annotation)

Removes the given Annotation from the chart.

Parameters
annotation the annotation to remove