|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objectplanet.chart.ChartData
public class ChartData
This class contains the data for one or more charts. A chart will render it's image using the data from this class. By letting several different charts share one data object, the data can be rendered in different styles.
Constructor Summary | |
---|---|
ChartData(int seriesCount,
int sampleCount)
Creates a new empty chart data with the specified number of series and samples. |
Method Summary | |
---|---|
int |
appendSample(int serie,
ChartSample sample,
boolean makeSpace)
Appends a sample to the given series. |
int |
appendSampleLabel(java.lang.String label,
boolean makeSpace)
Appends a sample labels If makeSpace is set to false, and all the sample labels are filled up, they will be scrolled to the left, with the left most label deleted. |
int |
appendSampleValue(int serie,
double value,
boolean makeSpace)
Appends a value to the given series. |
double |
getMaxValue(int serie)
Gets the largest value in the specified data series. |
double |
getMinValue(int serie)
Gets the smallest value in the specified data series. |
ChartSample |
getSample(int serie,
int index)
Gets the specified sample. |
ChartSample |
getSample(java.lang.Object key)
Gets the sample with the specified key. |
int |
getSampleCount()
Gets the number of samples. |
java.lang.String |
getSampleLabel(int index)
Gets the specified sample label. |
java.lang.String[] |
getSampleLabels()
Gets the sample labels. |
ChartSample[] |
getSamples(int serie)
Gets the samples for the specified serie. |
double |
getSampleValue(int serie,
int index)
Gets the specified sample value. |
double[] |
getSampleValues(int serie)
Gets the sample values for the specified serie. |
int |
getSeriesCount()
Gets the number of series. |
java.lang.String |
getSeriesLabel(int serie)
Gets the specified series label. |
java.lang.String[] |
getSeriesLabels()
Gets the series labels. |
boolean |
hasChangedSince(long time)
Checks if the data has been changed since the specified time. |
boolean |
isSelected(int serie,
int sample)
Checks if a sample is selected. |
void |
setSample(int serie,
int index,
ChartSample sample)
Sets the specified sample. |
void |
setSampleCount(int count)
Sets the number of samples. |
void |
setSampleLabel(int index,
java.lang.String label)
Sets the specified sample label. |
void |
setSampleLabels(java.lang.String[] labels)
Sets the sample labels. |
void |
setSamples(int serie,
ChartSample[] samples)
Sets the samples for the specified series. |
void |
setSampleValue(int serie,
int index,
double value)
Sets the specified sample value. |
void |
setSampleValues(int serie,
double[] values)
Sets the sample values for the specified series. |
void |
setSelection(int serie,
int sample,
boolean selected)
Marks a sample as selected or deselected. |
void |
setSeriesCount(int count)
Sets the number of series. |
void |
setSeriesLabel(int serie,
java.lang.String label)
Sets the specified series label. |
void |
setSeriesLabels(java.lang.String[] labels)
Sets the series labels. |
java.lang.String |
toString()
Returns a string with the number of series and samples. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ChartData(int seriesCount, int sampleCount)
seriesCount
- The number of series to use.sampleCount
- The number of sampels to use.Method Detail |
---|
public int appendSample(int serie, ChartSample sample, boolean makeSpace)
If the makeSpace parameter is set to false, all the current samples will shift to the left, and the new sample will be added at the end.
If the makeSpace parameter is set to true, the sample count will be increased by one, and the sample will be added at the end.
The sample labels are also moved to the left with the samples.
serie
- The series to append the sample to.sample
- The sample to append.makeSpace
- True to make space for the new parameter.
java.lang.IllegalArgumentException
- If the serie is invalid.public int appendSampleLabel(java.lang.String label, boolean makeSpace)
label
- The label to append.makeSpace
- True to make space for the new parameter.
public int appendSampleValue(int serie, double value, boolean makeSpace)
If the makeSpace parameter is set to false, all the current values will shift one sample to the left (the sample itself will not move, only the value) and the new value will be set in the last sample.
If the makeSpace parameter is set to true, the sample count will be increased by one, and a new sample will be added at the end.
serie
- The series to append the sample to.value
- The value to append.makeSpace
- True to make space for the new parameter.
java.lang.IllegalArgumentException
- If the serie is invalid.public double getMaxValue(int serie)
serie
- The index of the serie (0-based).public double getMinValue(int serie)
serie
- The index of the serie (0-based).public ChartSample getSample(int serie, int index)
serie
- The index of the serie (0-based).index
- The index of the sample (0-based).
java.lang.IllegalArgumentException
- if the serie or index is invalid.public ChartSample getSample(java.lang.Object key)
key
- The key of the sample to find.
public int getSampleCount()
public java.lang.String getSampleLabel(int index)
index
- The index of the sample (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public java.lang.String[] getSampleLabels()
public ChartSample[] getSamples(int serie)
serie
- The index of the serie (0-based).
java.lang.IllegalArgumentException
- if the serie is invalid.public double getSampleValue(int serie, int index)
serie
- The index of the serie (0-based).index
- The index of the sample (0-based).
java.lang.IllegalArgumentException
- if the serie or index is invalid.public double[] getSampleValues(int serie)
serie
- The index of the serie (0-based).
java.lang.IllegalArgumentException
- if the serie is invalid.public int getSeriesCount()
public java.lang.String getSeriesLabel(int serie)
serie
- The index of the serie (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public java.lang.String[] getSeriesLabels()
public boolean hasChangedSince(long time)
time
- The time to check for.
public boolean isSelected(int serie, int sample)
serie
- The series index (-1 is whole series).sample
- The sample index (-1 is all samples in series).
java.lang.IllegalArgumentException
- If the serie or sample is invalid.public void setSample(int serie, int index, ChartSample sample)
serie
- The index of the serie (0-based).index
- The index of the sample (0-based).sample
- The sample to use.
java.lang.IllegalArgumentException
- if the serie or index is invalid.public void setSampleCount(int count)
count
- The number of samples.public void setSampleLabel(int index, java.lang.String label)
index
- The index of the sample (0-based).label
- The label of the sample.public void setSampleLabels(java.lang.String[] labels)
labels
- The labels to use.public void setSamples(int serie, ChartSample[] samples)
serie
- The index of the serie (0-based).samples
- The samples to set.
java.lang.IllegalArgumentException
- if the serie is invalid.public void setSampleValue(int serie, int index, double value)
serie
- The index of the serie (0-based).index
- The index of the sample (0-based).value
- The value to use for the sample.
java.lang.IllegalArgumentException
- if the serie or index is invalid.public void setSampleValues(int serie, double[] values)
serie
- The index of the serie (0-based).values
- The values to use for the series.
java.lang.IllegalArgumentException
- if the serie is invalid.public void setSelection(int serie, int sample, boolean selected)
serie
- The series index.sample
- The sample index.selected
- True for selected, false for deselected.public void setSeriesCount(int count)
count
- The number of series.public void setSeriesLabel(int serie, java.lang.String label)
serie
- The index of the serie (0-based).label
- The label of the sample.
java.lang.IllegalArgumentException
- if the index is invalid.public void setSeriesLabels(java.lang.String[] labels)
labels
- The labels to use.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |