org.achartengine.model
Class XYSeries

java.lang.Object
  extended by org.achartengine.model.XYSeries
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TimeSeries, XYValueSeries

public class XYSeries
extends java.lang.Object
implements java.io.Serializable

An XY series encapsulates values for XY charts like line, time, area, scatter... charts.

See Also:
Serialized Form

Constructor Summary
XYSeries(java.lang.String title)
          Builds a new XY series.
XYSeries(java.lang.String title, int scaleNumber)
          Builds a new XY series.
 
Method Summary
 void add(double x, double y)
          Adds a new value to the series.
 void add(int index, double x, double y)
          Adds a new value to the series at the specified index.
 void addAnnotation(java.lang.String annotation, double x, double y)
          Add an String at (x,y) coordinates
 void clear()
          Removes all the existing values from the series.
 java.lang.String getAnnotationAt(int index)
          Get the String at index
 int getAnnotationCount()
          Get the annotations count
 double getAnnotationX(int index)
          Get X coordinate of the annotation at index
 double getAnnotationY(int index)
          Get Y coordinate of the annotation at index
 int getIndexForKey(double key)
           
 int getItemCount()
          Returns the series item count.
 double getMaxX()
          Returns the maximum value on the X axis.
 double getMaxY()
          Returns the maximum value on the Y axis.
 double getMinX()
          Returns the minimum value on the X axis.
 double getMinY()
          Returns the minimum value on the Y axis.
protected  double getPadding()
           
 java.util.SortedMap<java.lang.Double,java.lang.Double> getRange(double start, double stop, boolean beforeAfterPoints)
          Returns submap of x and y values according to the given start and end
 int getScaleNumber()
           
 java.lang.String getTitle()
          Returns the series title.
 double getX(int index)
          Returns the X axis value at the specified index.
 double getY(int index)
          Returns the Y axis value at the specified index.
 void remove(int index)
          Removes an existing value from the series.
 void removeAnnotation(int index)
          Remove an String at index
 void setTitle(java.lang.String title)
          Sets the series title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYSeries

public XYSeries(java.lang.String title)
Builds a new XY series.

Parameters:
title - the series title.

XYSeries

public XYSeries(java.lang.String title,
                int scaleNumber)
Builds a new XY series.

Parameters:
title - the series title.
scaleNumber - the series scale number
Method Detail

getScaleNumber

public int getScaleNumber()

getTitle

public java.lang.String getTitle()
Returns the series title.

Returns:
the series title

setTitle

public void setTitle(java.lang.String title)
Sets the series title.

Parameters:
title - the series title

add

public void add(double x,
                double y)
Adds a new value to the series.

Parameters:
x - the value for the X axis
y - the value for the Y axis

add

public void add(int index,
                double x,
                double y)
Adds a new value to the series at the specified index.

Parameters:
index - the index to be added the data to
x - the value for the X axis
y - the value for the Y axis

getPadding

protected double getPadding()

remove

public void remove(int index)
Removes an existing value from the series.

Parameters:
index - the index in the series of the value to remove

clear

public void clear()
Removes all the existing values from the series.


getX

public double getX(int index)
Returns the X axis value at the specified index.

Parameters:
index - the index
Returns:
the X value

getY

public double getY(int index)
Returns the Y axis value at the specified index.

Parameters:
index - the index
Returns:
the Y value

addAnnotation

public void addAnnotation(java.lang.String annotation,
                          double x,
                          double y)
Add an String at (x,y) coordinates

Parameters:
annotation - String text
x -
y -

removeAnnotation

public void removeAnnotation(int index)
Remove an String at index

Parameters:
index -

getAnnotationX

public double getAnnotationX(int index)
Get X coordinate of the annotation at index

Parameters:
index - the index in the annotations list
Returns:
the corresponding annotation X value

getAnnotationY

public double getAnnotationY(int index)
Get Y coordinate of the annotation at index

Parameters:
index - the index in the annotations list
Returns:
the corresponding annotation Y value

getAnnotationCount

public int getAnnotationCount()
Get the annotations count

Returns:
the annotations count

getAnnotationAt

public java.lang.String getAnnotationAt(int index)
Get the String at index

Parameters:
index -
Returns:
String

getRange

public java.util.SortedMap<java.lang.Double,java.lang.Double> getRange(double start,
                                                                       double stop,
                                                                       boolean beforeAfterPoints)
Returns submap of x and y values according to the given start and end

Parameters:
start - start x value
stop - stop x value
beforeAfterPoints - if the points before and after the first and last visible ones must be displayed
Returns:
a submap of x and y values

getIndexForKey

public int getIndexForKey(double key)

getItemCount

public int getItemCount()
Returns the series item count.

Returns:
the series item count

getMinX

public double getMinX()
Returns the minimum value on the X axis.

Returns:
the X axis minimum value

getMinY

public double getMinY()
Returns the minimum value on the Y axis.

Returns:
the Y axis minimum value

getMaxX

public double getMaxX()
Returns the maximum value on the X axis.

Returns:
the X axis maximum value

getMaxY

public double getMaxY()
Returns the maximum value on the Y axis.

Returns:
the Y axis maximum value


Copyright © 2009 - 2011 4ViewSoft. All Rights Reserved.