Summ:  Methods    Details:  Methods      Class:  Prev Next
com.artfulbits.aiCharts.Base
Class ChartPointCollection

java.lang.Object com.artfulbits.aiCharts.Base.ChartPointCollection

Declaration: public final class ChartPointCollection extends Object
implements java.lang.Iterable<ChartPoint>
All Interfaces: java.lang.Iterable<ChartPoint>

 

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

 

Since: 1.0

 

 

Methods Summary
boolean add(ChartPoint point)
    
Adds the point to points collection.
ChartPoint addDate(java.util.Calendar xDateValue, double... y)
    
Adds specified date point to points collection.
ChartPoint addDate(java.util.Date xDateValue, double... y)
    
Adds specified date point to points collection.
ChartPoint addDate(long 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.
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(ChartPoint point)
    
Gets index of point in the collection.
java.util.Iterator<ChartPoint> iterator()
    
void remove(ChartPoint point)
    
Removes specified point.
void removeAt(int index)
    
Removes point at specified location.
void setData(byte[] source)
    
Fills chart points collection with specified source points.
void setData(android.database.Cursor cursor, IItemBinder<ChartPoint> binder)
    
Adds points from database cursor.
void setData(android.database.Cursor cursor, int xIndex, int[] yValueIndices)
    
Adds points from database cursor.
void setData(double[] source)
    
Adds points from array of double.
void setData(org.w3c.dom.Element xmlElement, boolean searchAmongAttributes, java.lang.String xValueName, java.lang.String... yValueNames)
    
Adds points from element's nodes collection.
void setData(org.w3c.dom.Element xmlElement, IItemBinder<ChartPoint> binder)
    
Adds points from element's nodes collection using binder.
void setData(java.lang.Iterable<?> itarable, IItemBinder<ChartPoint> binder)
    
Adds points from itarable.
void setData(long[] source)
    
Fills chart points collection with specified source points.
void setData(android.database.sqlite.SQLiteDatabase source, java.lang.String tableName, java.lang.String[] yValueNames)
    
Adds points from SQLite database.
int size()
    
Gets the size of points collection.
ChartPoint[] toArray()
    
Returns a new array containing all elements from in this collection.

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

size

 

public int size( )

 

Gets the size of points collection.

 

Returns:
size of this collection.

 

Since: 1.0

 

 

 

setData

 

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.

 

Since: 1.0

 

 

 

setData

 

public void setData( byte[] source)

 

Fills chart points collection with specified source points.

 

Parameters:
source-
byte array as source of points.

 

Since: 1.5

 

 

 

setData

 

public void setData( long[] source)

 

Fills chart points collection with specified source points.

 

Parameters:
source-
source long array as source of points.

 

Since: 1.5

 

 

 

setData

 

public void setData( org.w3c.dom.Element xmlElement,
IItemBinder<ChartPointbinder)

 

Adds points from element's nodes collection using binder.

 

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

 

Since: 1.0

 

 

 

setData

 

public void setData( org.w3c.dom.Element xmlElement,
boolean searchAmongAttributes,
java.lang.String xValueName,
java.lang.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).

 

Since: 1.0

 

 

 

setData

 

public void setData( android.database.sqlite.SQLiteDatabase source,
java.lang.String tableName,
java.lang.String[] yValueNames)

 

Adds points from SQLite database.

 

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

 

Since: 1.0

 

 

 

setData

 

public void setData( android.database.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

 

Since: 1.0

 

 

 

setData

 

public void setData( android.database.Cursor cursor,
IItemBinder<ChartPointbinder)

 

Adds points from database cursor.

 

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

 

Since: 1.0
See also: setData(Cursor,int,int[])

 

 

 

setData

 

public void setData( java.lang.Iterable<?> itarable,
IItemBinder<ChartPointbinder)

 

Adds points from itarable.

 

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

 

Since: 1.0
See also: setData(Cursor,int,int[])

 

 

 

beginUpdate

 

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().

 

Since: 1.5
See also: endUpdate()

 

 

 

endUpdate

 

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().

 

Since: 1.5

 

 

 

get

 

public ChartPoint get( int index)

 

Returns ChartPoint at specified index.

 

Parameters:
index-
zero-based index of point
Returns:
instance of ChartPoint class.

 

Since: 1.0

 

 

 

indexOf

 

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.

 

Since: 1.0

 

 

 

add

 

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.

 

Since: 1.0

 

 

 

remove

 

public void remove( ChartPoint point)

 

Removes specified point.

 

Parameters:
point-
instance of ChartPoint class that is assumed to be present in this collection.

 

Since: 1.0

 

 

 

removeAt

 

public void removeAt( int index)

 

Removes point at specified location.

 

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

 

Since: 1.0

 

 

 

addXY

 

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.

 

Since: 1.0

 

 

 

addDate

 

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

 

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

 

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

 

Since: 1.0

 

 

 

addDate

 

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

 

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

 

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

 

Since: 1.0

 

 

 

addDate

 

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

 

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

 

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

 

Since: 1.0

 

 

 

clear

 

public void clear( )

 

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

 

Since: 1.0

 

 

 

iterator

 

public java.util.Iterator<ChartPoint> iterator( )

 

Implements: java.lang.Iterable.iterator()

 

 

 

toArray

 

public ChartPoint[] toArray( )

 

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

 

Returns:
an array of points from this collection.

 

Since: 1.0

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.