public final class

ChartPointCollection

extends Object
implements List<E>
java.lang.Object
   ↳ com.artfulbits.aiCharts.Base.ChartPointCollection

Class Overview

Represents chart points collection used to store chart points or any wrappers on them.

Summary

Public Methods
boolean add(ChartPoint point)
Adds the point to points collection.
void add(int location, ChartPoint point)
boolean addAll(int index, Collection<? extends ChartPoint> collection)
boolean addAll(Collection<? extends ChartPoint> collection)
ChartPoint addDate(Calendar xDateValue, double... y)
Adds specified date point to points collection.
ChartPoint addDate(long xDateValue, double... y)
Adds specified date point to points collection.
ChartPoint addDate(Date xDateValue, double... y)
Adds specified date point to points collection.
ChartPoint addXY(double x, double... y)
Adds specified point to points collection.
void beginUpdate()
Tells chart engine to begin update of chart points.
void clear()
Clears the points collection.
boolean contains(Object object)
boolean containsAll(Collection<?> collection)
void endUpdate()
Tells chart engine that chart points update was finished and it's time to redraw.
ChartPoint get(int index)
Returns ChartPoint at specified index.
int indexOf(Object point)
int indexOf(ChartPoint point)
Gets index of point in the collection.
boolean isEmpty()
Iterator<ChartPoint> iterator()
int lastIndexOf(Object point)
ListIterator<ChartPoint> listIterator(int location)
ListIterator<ChartPoint> listIterator()
ChartPoint remove(int location)
boolean remove(Object object)
boolean removeAll(Collection<?> collection)
void removeAt(int index)
This method is deprecated. remove(int);
boolean retainAll(Collection<?> collection)
ChartPoint set(int location, ChartPoint point)
void setData(Element xmlElement, IItemBinder<ChartPoint> binder)
Adds points from element's nodes collection using binder.
void setData(Iterable<?> itarable, IItemBinder<ChartPoint> binder)
Adds points from itarable.
void setData(byte[] source)
Fills chart points collection with specified source points.
void setData(double[] source)
Adds points from array of double.
void setData(SQLiteDatabase source, String tableName, String[] yValueNames)
Adds points from SQLite database.
void setData(long[] source)
Fills chart points collection with specified source points.
void setData(Cursor cursor, int xIndex, int[] yValueIndices)
Adds points from database cursor.
void setData(Cursor cursor, IItemBinder<ChartPoint> binder)
Adds points from database cursor.
void setData(Element xmlElement, boolean searchAmongAttributes, String xValueName, String... yValueNames)
Adds points from element's nodes collection.
int size()
Gets the size of points collection.
List<ChartPoint> subList(int start, int end)
<T> T[] toArray(T[] contents)
ChartPoint[] toArray()
Returns a new array containing all elements from in this collection.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.List

Public Methods

public boolean add (ChartPoint point)

Adds the point to points collection.

Parameters
point to add to collection.
Returns
  • true if this collection was changed as a result of the call, otherwise false.

public void add (int location, ChartPoint point)

public boolean addAll (int index, Collection<? extends ChartPoint> collection)

public boolean addAll (Collection<? extends ChartPoint> collection)

public ChartPoint addDate (Calendar xDateValue, double... y)

Adds specified date point to points collection. Internally sets ValueType property on series to Double

Parameters
xDateValue date value of point.
y corresponding Y value(s).
Returns
  • true if the point was successfully added to collection.

public ChartPoint addDate (long xDateValue, double... y)

Adds specified date point to points collection. Internally sets ValueType property on series to Double

Parameters
xDateValue date in milliseconds.
y corresponding Y value(s).
Returns
  • true if the point was successfully added to collection.

public ChartPoint addDate (Date xDateValue, double... y)

Adds specified date point to points collection. Internally sets ValueType property on series to Double

Parameters
xDateValue date value of point.
y corresponding Y value(s).
Returns
  • true if the point was successfully added to collection.

public ChartPoint addXY (double x, double... y)

Adds specified point to points collection.

Parameters
x X value of point.
y Y values of point.
Returns
  • true if the point was successfully added to collection.

public void beginUpdate ()

Tells chart engine to begin update of chart points. After this call no UI updates will be executed until call to endUpdate().

See Also

public void clear ()

Clears the points collection. For each point disconnects any series attached.

public boolean contains (Object object)

public boolean containsAll (Collection<?> collection)

public void endUpdate ()

Tells chart engine that chart points update was finished and it's time to redraw. Use this call in conjunction with beginUpdate().

public ChartPoint get (int index)

Returns ChartPoint at specified index.

Parameters
index zero-based index of point
Returns

public int indexOf (Object point)

public int indexOf (ChartPoint point)

Gets index of point in the collection.

Parameters
point instance of point that is assumed to be present in collection.
Returns
  • zero-based index of point.

public boolean isEmpty ()

public Iterator<ChartPoint> iterator ()

public int lastIndexOf (Object point)

public ListIterator<ChartPoint> listIterator (int location)

public ListIterator<ChartPoint> listIterator ()

public ChartPoint remove (int location)

public boolean remove (Object object)

public boolean removeAll (Collection<?> collection)

public void removeAt (int index)

This method is deprecated.
remove(int);

Removes point at specified location.

Parameters
index zero-based index of point that should be removed.

public boolean retainAll (Collection<?> collection)

public ChartPoint set (int location, ChartPoint point)

public void setData (Element xmlElement, IItemBinder<ChartPoint> binder)

Adds points from element's nodes collection using binder.

Parameters
xmlElement element that contains nodes tree.
binder IItemBinder instance to bind points.

public void setData (Iterable<?> itarable, IItemBinder<ChartPoint> binder)

Adds points from itarable.

Parameters
itarable - the itarable source.
binder - binds point to source item. Set null to use default binding.

public void setData (byte[] source)

Fills chart points collection with specified source points.

Parameters
source byte array as source of points.

public void setData (double[] source)

Adds points from array of double. Fills collection with source values. Each point in resulting collection will have its X value equal to corresponding source index. Therefore, for source = {2,3,6,1,5} following points (1,2) (2,3) (3,6) (4,1) (5,5) will be created.

Parameters
source an array of Y values.

public void setData (SQLiteDatabase source, String tableName, String[] yValueNames)

Adds points from SQLite database.

Parameters
source SQLite database
tableName the name of database table.
yValueNames the column name of Y values.

public void setData (long[] source)

Fills chart points collection with specified source points.

Parameters
source source long array as source of points.

public void setData (Cursor cursor, int xIndex, int[] yValueIndices)

Adds points from database cursor.

Parameters
cursor - the database cursor.
xIndex - the column index of X values
yValueIndices - the column indices of Y values

public void setData (Cursor cursor, IItemBinder<ChartPoint> binder)

Adds points from database cursor.

Parameters
cursor - the database cursor.
binder - binds point to source item. Set null to use default binding.

public void setData (Element xmlElement, boolean searchAmongAttributes, String xValueName, String... yValueNames)

Adds points from element's nodes collection. In xmlElement data can be retrieved in two ways: searching in nested elements or among attributes
Attributes searching logic expects following XML structure:

 <Points>
  <Point X="1" Y1="2" Y2="10" />
  <Point Y1="53" Y2="60" X="3" />
  <Point Y1="81" X="4" Y2="90" />
 </Points>
 
Code sample:
 ChartSeries series = new ChartSeries("Series", ChartTypes.FastLine);
 ChartPointCollection seriesPoints = series.getPoints();
 Document doc = db.parse(this.getAssets().open("data_by_attributes.xml"));
 seriesPoints.setData(doc.getDocumentElement(), true, "X", "Y1");
 
Nested elements searching logic expects following XML structure:
 <Points>
  <Point>
   <X>1</X>
   <Y>4</Y>
  </Point>
  <Point>
   <X>2</X>
   <Y>5</Y>
  </Point>
  <Point>
   <X>4</X>
   <Y>10</Y>
  </Point>
 </Points>
 
Code sample:
 ChartSeries series = new ChartSeries("Series", ChartTypes.FastLine);
 ChartPointCollection seriesPoints = series.getPoints();
 Document doc = db.parse(this.getAssets().open("data_by_elements.xml"));
 seriesPoints.setData(doc.getDocumentElement(), false, "X", "Y");
 

Parameters
xmlElement target xml element.
searchAmongAttributes indicates whether target values should be considered as attributes.
xValueName target name for X value.
yValueNames target name(s) for X value(s).

public int size ()

Gets the size of points collection.

Returns
  • size of this collection.

public List<ChartPoint> subList (int start, int end)

public T[] toArray (T[] contents)

public ChartPoint[] toArray ()

Returns a new array containing all elements from in this collection.

Returns
  • an array of points from this collection.