|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart2djava.ChartObj
com.quinncurtis.chart2djava.ChartDataset
com.quinncurtis.chart2djava.SimpleDataset
com.quinncurtis.chart2djava.TimeSimpleDataset
public class TimeSimpleDataset
A simple dataset class encapsulates x- and y-data values that are to be used as source of chart information. Copies of the original data arrays are stored. The original source data can be deleted once the dataset is created. If you want to make any changes to the data, you must change the data in the dataset, not the original source data. The TimeSimpleDataset class extends the SimpleDataset class so that it can use GregorinalCalendar values as the x- and y-values.
Field Summary |
---|
Fields inherited from class com.quinncurtis.chart2djava.ChartDataset |
---|
initialCondition, markLookaheadLimit |
Constructor Summary | |
---|---|
TimeSimpleDataset()
The default SimpleDataset constructor. |
|
TimeSimpleDataset(CSV csv,
java.lang.String filename,
int rowskip,
int columnskip)
This constructor creates a new TimeSimpleDataset object from a file consisting of comma separated values. |
|
TimeSimpleDataset(java.lang.String sname,
double[] x,
double[] y)
This constructor initializes the name, x- and y- values of a simple dataset. |
|
TimeSimpleDataset(java.lang.String sname,
double[] x,
java.util.GregorianCalendar[] y)
This constructor initializes the name, x- and y- values of a simple dataset. |
|
TimeSimpleDataset(java.lang.String sname,
java.util.GregorianCalendar[] x,
double[] y)
This constructor initializes the name, x- and y- values of a simple dataset. |
|
TimeSimpleDataset(java.lang.String sname,
java.util.GregorianCalendar[] x,
java.util.GregorianCalendar[] y)
This constructor initializes the name, x- and y- values of a simple dataset. |
|
TimeSimpleDataset(java.lang.String sname,
int n)
This constructor creates an uninitialized dataset of the specified size. |
Method Summary | |
---|---|
int |
addTimeDataPoint(double x,
java.util.GregorianCalendar y)
This method adds a new data point (floating point x-value, GregorianCalendar y-value) at the end of the dataset, increasing its size by one. |
int |
addTimeDataPoint(java.util.GregorianCalendar x,
double y)
This method adds a new data point (GregorianCalendar x-value, floating point y-value) at the end of the dataset, increasing its size by one. |
java.lang.Object |
clone()
Returns an object that is a clone of this TimeSimpleDataset object. |
TimeSimpleDataset |
compressTimeFieldSimpleDataset(int ctypex,
int ctypey,
int timefield,
int startindex,
int endindex,
java.lang.String newname)
This methods creates and returns a new dataset that is the data reduced version of the source dataset. |
TimeSimpleDataset |
compressTimeSimpleDataset(int ctypex,
int ctypey,
int interval,
int startindex,
int endindex,
java.lang.String newname)
This methods creates and returns a new dataset that is the data reduced version of the source dataset. |
void |
copy(TimeSimpleDataset source)
Copies the source dataset. |
int |
deleteTimeDataPoint(int deletepoint)
Deletes a data point at the specified location, decreasing the size of the dataset by one. |
int |
errorCheck(int nerror)
Checks the simple dataset object for common errors. |
java.util.GregorianCalendar[] |
getTimeXData()
This method returns a reference to the xData array. |
java.util.GregorianCalendar |
getTimeXDataValue(int index)
This method returns the GregorianCalendar x-value at the specified index. |
java.util.GregorianCalendar[] |
getTimeYData()
This method returns a reference to the yData array. |
java.util.GregorianCalendar |
getTimeYDataValue(int index)
This method returns the GregorianCalendar y-value at the specified index. |
void |
initDataset(java.lang.String sname,
java.util.GregorianCalendar[] x,
double[] y)
A TimeSimpleDataset initialization method that initializes the name, x- and y- values of a simple dataset. |
void |
initializeData(java.util.GregorianCalendar[] x,
double[] y)
an SimpleDataset initialization method that initializes the x- and y-data values of a simple dataset. |
int |
insertTimeDataPoint(java.util.GregorianCalendar x,
double y,
int insertpoint)
Insert a data point at the specified location, increasing the size of the dataset by one. |
void |
readTimeSimpleDataset(CSV csv,
java.lang.String filename,
int rowskip,
int columnskip)
This method initializes the TimeSimpleDataset object from a file consisting of comma separated values. |
void |
readTimeSimpleDatasetAsResource(CSV csv,
java.io.BufferedReader pReader,
int rowskip,
int columnskip)
This method initializes the TimeSimpleDataset object from a file consisting of comma separated values. |
void |
setTimeDataPoint(int index,
double x,
java.util.GregorianCalendar y)
Sets a data point (floating point x-value, GregorianCalendar y-value) at the specified index. |
void |
setTimeDataPoint(int index,
java.util.GregorianCalendar x,
double y)
Sets a data point (GregorianCalendar x-value, floating point y-value) at the specified index. |
void |
setTimeXDataValue(int index,
java.util.GregorianCalendar x)
Sets a GregorianCalendar x-value at the specified index. |
void |
setTimeYDataValue(int index,
java.util.GregorianCalendar y)
Sets a GregorianCalendar y-value at the specified index. |
void |
writeTimeSimpleDataset(CSV csv,
java.lang.String filename)
This methods will create a text file and output the TimeSimpleDataset to that file in a CSV (Comma Separated Value) format. |
void |
writeTimeSimpleDataset(CSV csv,
java.lang.String filename,
boolean append)
This methods will create a text file and output the TimeSimpleDataset to that file in a CSV (Comma Separated Value) format. |
Methods inherited from class com.quinncurtis.chart2djava.ChartObj |
---|
copy, getChartObjIDCntr, getChartObjType, getThisChartObjID, TypeSafeVectorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeSimpleDataset()
public TimeSimpleDataset(CSV csv, java.lang.String filename, int rowskip, int columnskip)
csv
- An instance of an CSV object.filename
- The name of the file.rowskip
- Skip this many rows before starting the read operation.columnskip
- For each row of data, skip this many columns before reading the first value
from the row.public TimeSimpleDataset(java.lang.String sname, double[] x, double[] y)
sname
- Specifies the name of the dataset.x
- An array that specifies the x-values of a dataset.y
- An array that specifies the y-values of a dataset.public TimeSimpleDataset(java.lang.String sname, double[] x, java.util.GregorianCalendar[] y)
sname
- Specifies the name of the dataset.x
- An array that specifies the x-values of a dataset.y
- An array that specifies the y-values of a dataset.public TimeSimpleDataset(java.lang.String sname, java.util.GregorianCalendar[] x, double[] y)
sname
- Specifies the name of the dataset.x
- An array that specifies the x-values of a dataset.y
- An array that specifies the y-values of a dataset.public TimeSimpleDataset(java.lang.String sname, java.util.GregorianCalendar[] x, java.util.GregorianCalendar[] y)
sname
- Specifies the name of the dataset.x
- An array that specifies the x-values of a dataset.y
- An array that specifies the y-values of a dataset.public TimeSimpleDataset(java.lang.String sname, int n)
sname
- Specifies the name of the dataset.n
- Specifies the number of datapoints in the dataset.Method Detail |
---|
public int addTimeDataPoint(double x, java.util.GregorianCalendar y)
x
- Specifies the new x-value for the data point at the specified index.y
- Specifies the new y-value for the data point at the specified index.
public int addTimeDataPoint(java.util.GregorianCalendar x, double y)
x
- Specifies the new x-value for the data point at the specified index.y
- Specifies the new y-value for the data point at the specified index.
public java.lang.Object clone()
clone
in class SimpleDataset
public TimeSimpleDataset compressTimeFieldSimpleDataset(int ctypex, int ctypey, int timefield, int startindex, int endindex, java.lang.String newname)
ctypex
- The compression type. Use one of the data compression type constants:
DATACOMPRESS_NONE (returns a dataset containing the points in the specified range, no compression),
DATACOMPRESS_SKIP (sample the dataset every interval points), DATACOMPRESS_AVERAGE (use the average
x- and y-value in each interval), DATACOMPRESS_MIN (use the minimum x- and y-value in each interval),
DATACOMPRESS_MAX (use the maximum x- and y-value in each interval), and DATACOMPRESS_MINMAX
(use the minimum and maximum x- and y-value in each interval). The DATACOMPRESS_MINMAX compression
type is best used when the compressed data values number more than 1000, where adjacent data values
in the rendered chart differ by one horizontal pixel or less. The DATACOMPRESS_MINMAX compression
type will guarantee that the chart displays the same minimums and maximums as the original dataset.ctypey
- The compression type for the y-values. Use one of the he data compression type
constants.timefield
- All values with the same timefield value are compressed to a single value.
Use one of the time field constants in the GregorianCalendar class - ChartConstants.YEAR, ChartConstants.MONTH,
GregorianCalendar.WEEK_OF_YEAR, GregorianCalendar.WEEK_OF_MONTH, ChartConstants.DAY_OF_YEAR, ChartConstants.HOUR_OF_DAY,
ChartConstants.MINUTE.startindex
- The starting point, inclusive, in the source dataset for the data compression.endindex
- The ending index, inclusive, in the source dataset for the data compression.newname
- The string name for the new dataset.
public TimeSimpleDataset compressTimeSimpleDataset(int ctypex, int ctypey, int interval, int startindex, int endindex, java.lang.String newname)
ctypex
- The compression type. Use one of the data compression type constants:
DATACOMPRESS_NONE (returns a dataset containing the points in the specified range, no compression),
DATACOMPRESS_SKIP (sample the dataset every interval points), DATACOMPRESS_AVERAGE (use the average
x- and y-value in each interval), DATACOMPRESS_MIN (use the minimum x- and y-value in each interval),
DATACOMPRESS_MAX (use the maximum x- and y-value in each interval), and DATACOMPRESS_MINMAX (use the
minimum and maximum x- and y-value in each interval). The DATACOMPRESS_MINMAX compression type is best
used when the compressed data values number more than 1000, where adjacent data values in the rendered
chart differ by one horizontal pixel or less. The DATACOMPRESS_MINMAX compression type will guarantee
that the chart displays the same minimums and maximums as the original dataset.ctypey
- The compression type for the y-values. Use one of the he data compression type
constants.interval
- The number of data points in each segment that is reduced to a single datapoint
(two for the DATACOMPRESS_MINMAX compression type) in the compressed dataset.startindex
- The starting point, inclusive, in the source dataset for the data compression.endindex
- The ending index, inclusive, in the source dataset for the data compression.newname
- The string name for the new dataset.
public void copy(TimeSimpleDataset source)
source
- The source dataset object.public int deleteTimeDataPoint(int deletepoint)
deletepoint
- The delete point. Zero based array indexing is used, so the 5th data point
in the array has an index value of 4.
public int errorCheck(int nerror)
SimpleDataset
errorCheck
in class SimpleDataset
nerror
- Current error state
public java.util.GregorianCalendar[] getTimeXData()
public java.util.GregorianCalendar getTimeXDataValue(int index)
index
- Specifies the index of the x-value.
public java.util.GregorianCalendar[] getTimeYData()
public java.util.GregorianCalendar getTimeYDataValue(int index)
index
- Specifies the index of the y-value.
public void initDataset(java.lang.String sname, java.util.GregorianCalendar[] x, double[] y)
sname
- Specifies the name of the dataset.x
- An array that specifies the x-values of a dataset.y
- An array the y-values of a dataset.public void initializeData(java.util.GregorianCalendar[] x, double[] y)
x
- An array that specifies the x-values of a dataset.y
- An array the y-values of a dataset.public int insertTimeDataPoint(java.util.GregorianCalendar x, double y, int insertpoint)
x
- The date x-value of the point to insert.y
- The y-value of the point to insertinsertpoint
- The insertion point of the data. Zero based array indexing is used, so the
5th data point in the array has an index value of 4.
public void readTimeSimpleDataset(CSV csv, java.lang.String filename, int rowskip, int columnskip)
csv
- An instance of an CSV object.filename
- The name of the file.rowskip
- Skip this many rows before starting the read operation.columnskip
- For each row of data, skip this many columns before reading the first value
from the row.public void readTimeSimpleDatasetAsResource(CSV csv, java.io.BufferedReader pReader, int rowskip, int columnskip)
csv
- An instance of an CSV object.pReader
- A BufferedReader data stream. Must support BufferedReader mark and reset methods.rowskip
- Skip this many rows before starting the read operation.columnskip
- For each row of data, skip this many columns before reading the first value
from the row.public void setTimeDataPoint(int index, double x, java.util.GregorianCalendar y)
x
- Specifies the new x-value for the data point at the specified index.y
- Specifies the new y-value for the data point at the specified index.index
- Specifies the index for the new data value.public void setTimeDataPoint(int index, java.util.GregorianCalendar x, double y)
index
- Specifies the index for the new data value.x
- Specifies the new x-value for the data point at the specified index.y
- Specifies the new y-value for the data point at the specified index.public void setTimeXDataValue(int index, java.util.GregorianCalendar x)
index
- Specifies the index for the new data value.x
- Specifies the new x-value for the data point at the specified index.public void setTimeYDataValue(int index, java.util.GregorianCalendar y)
index
- Specifies the index for the new data value.y
- Specifies the new y-value for the data point at the specified index.public void writeTimeSimpleDataset(CSV csv, java.lang.String filename)
csv
- An instance of an CSV object.filename
- The name of the file.public void writeTimeSimpleDataset(CSV csv, java.lang.String filename, boolean append)
csv
- An instance of an CSV object.filename
- The name of the file.append
- True and if the file exists, data is appended to the file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |