no.hig.okolloen.graphics.chart
Class ChartDataSet

java.lang.Object
  |
  +--no.hig.okolloen.graphics.chart.ChartDataSet
Direct Known Subclasses:
ScaledChartDataSet

public class ChartDataSet
extends java.lang.Object

The ChartDataSet class is used to hold data values used by LineChart and BarChart. It is more or less just a vector of ChartItems.

Since:
rev 0.1

Constructor Summary
ChartDataSet(int maxElements)
          Constructor for the ChartDataSet class.
 
Method Summary
 void addElement(ChartItem item)
          Adds an element to the ChartDataSet.
 void addElement(double value)
          Adds an element to the ChartDataSet.
 void addElement(double value, java.awt.Color color)
          Adds an element to the ChartDataSet.
 void addElement(double value, java.awt.Color color, java.lang.String title)
          Adds an element to the ChartDataSet.
 void clear()
          Clears the entire ChartDataSet.
 ChartItem getElementAt(int element)
          Returns the element with the given index as a ChartItem
 void removeElementAt(int element)
          Removes the element at the given index. all elements behind this index will be shifted down.
 void setElementAt(int element, ChartItem item)
          Sets element at given index in the ChartDataSet to given value.
 void setElementAt(int element, double value)
          Sets element at given index in the ChartDataSet to given value.
 void setElementAt(int element, double value, java.awt.Color color)
          Sets element at given index in the ChartDataSet to given value and color.
 void setElementAt(int element, double value, java.awt.Color color, java.lang.String title)
          Sets element at given index in the ChartDataSet to given value, color and with given title.
 int size()
          Returns the number of elements currently held in this ChartDataSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartDataSet

public ChartDataSet(int maxElements)
Constructor for the ChartDataSet class.
Parameters:
maxElements - the maximum number of elements held by this ChartDataSet.
Method Detail

addElement

public void addElement(ChartItem item)
Adds an element to the ChartDataSet. If this results in more than the maximum number of items being held in the dataset the first element is thrown away.
Parameters:
item - the ChartItem to add.

addElement

public void addElement(double value)
Adds an element to the ChartDataSet. If this results in more than the maximum number of items being held in the dataset the first element is thrown away.
Parameters:
value - the value of this datapoint.

addElement

public void addElement(double value,
                       java.awt.Color color)
Adds an element to the ChartDataSet. If this results in more than the maximum number of items being held in the dataset the first element is thrown away.
Parameters:
value - the value of this datapoint.
color - the color that will be used when representing this datapoint

addElement

public void addElement(double value,
                       java.awt.Color color,
                       java.lang.String title)
Adds an element to the ChartDataSet. If this results in more than the maximum number of items being held in the dataset the first element is thrown away.
Parameters:
value - the value of this datapoint.
color - the color that will be used when representing this datapoint
title - the title to give this datapoint

setElementAt

public void setElementAt(int element,
                         ChartItem item)
Sets element at given index in the ChartDataSet to given value.
Parameters:
element - the index in the ChartDataSet where this item is to be placed.
item - the item to put into this position.

setElementAt

public void setElementAt(int element,
                         double value)
Sets element at given index in the ChartDataSet to given value.
Parameters:
value - the value of this datapoint.

setElementAt

public void setElementAt(int element,
                         double value,
                         java.awt.Color color)
Sets element at given index in the ChartDataSet to given value and color.
Parameters:
value - the value of this datapoint.
color - the color of used for the datapoint.

setElementAt

public void setElementAt(int element,
                         double value,
                         java.awt.Color color,
                         java.lang.String title)
Sets element at given index in the ChartDataSet to given value, color and with given title.
Parameters:
value - the value of this datapoint.
color - the color of used for the datapoint.
title - the title to use for this datapoint.

removeElementAt

public void removeElementAt(int element)
Removes the element at the given index. all elements behind this index will be shifted down.
Parameters:
element - the index of the element to be removed.

clear

public void clear()
Clears the entire ChartDataSet.

getElementAt

public ChartItem getElementAt(int element)
Returns the element with the given index as a ChartItem
Returns:
ChartItem object representing the datapoint at index element.

size

public int size()
Returns the number of elements currently held in this ChartDataSet.
Returns:
int value representing the number of data points held in the set.