|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.quinncurtis.chart3djava.ChartObj
com.quinncurtis.chart3djava.ChartDataset
com.quinncurtis.chart3djava.SimpleDataset
public class SimpleDataset
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.
| Field Summary |
|---|
| Fields inherited from class com.quinncurtis.chart3djava.ChartDataset |
|---|
initialCondition, markLookaheadLimit |
| Constructor Summary | |
|---|---|
SimpleDataset()
The default SimpleDataset constructor. |
|
SimpleDataset(CSV csv,
java.lang.String filename,
int rowskip,
int columnskip)
This constructor creates a new SimpleDataset object from a file consisting of comma separated values. |
|
SimpleDataset(java.lang.String sname,
double[] x,
double[] y)
This constructor creates a new, simple SimpleDataset object initializing each value with the values of the source x- and y- arrays. |
|
SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
boolean[] valid)
This constructor creates a new, simple SimpleDataset object initializing each value with the values of the source x- and y- arrays. |
|
SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
boolean[] valid,
int n)
This constructor creates a new, simple SimpleDataset object initializing each value with the values of the source x- and y- arrays. |
|
SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
double zvalue,
double depthvalue)
This constructor creates a new, simple SimpleDataset object initializing each value with the values of the source x- and y- arrays. |
|
SimpleDataset(java.lang.String sname,
int n)
This constructor creates a new, simple SimpleDataset object. |
|
| Method Summary | |
|---|---|
int |
addDataPoint(ChartPoint3D p)
This method adds a new xy point to a dataset, increasing its size by one. |
int |
addDataPoint(double x,
double y)
This method adds a new xy point to a dataset, increasing its size by one. |
boolean |
calcNearestPoint(PhysicalCoordinates transform,
ChartPoint3D testpoint,
int nmode,
NearestPointData nearestpoint)
This method compares a test point against all of the xy points in a simple dataset and calculates which point in the dataset is nearest the test point. |
boolean |
checkValidData(PhysicalCoordinates transform,
int index)
This method checks to see if the x- and y-data values for a given index are valid, taking into account any discontinuities in the coordinate system. |
boolean |
checkValidDataX(PhysicalCoordinates transform,
int index)
This method checks to see if the x-data value is valid, taking into account any discontinuities in the coordinate system. |
boolean |
checkValidDataY(PhysicalCoordinates transform,
int index)
This method checks to see if the y-data value is valid, taking into account any discontinuities in the coordinate system. |
java.lang.Object |
clone()
Returns an object that is a clone of this SimpleDataset object. |
void |
combineDataset(SimpleDataset source,
int combinecoord,
int op)
Combine this dataset with another, using one of three combine modes (COMBINE_DATASET_X, COMBINE_DATASET_Y, or COMBINE_DATASET_XY), and four combine operators (COMBINE_DATASET_ADD, COMBINE_DATASET_SUBTRACT, COMBINE_DATASET_MUTLIPLY or COMBINE_DATASET_DIVIDE). |
SimpleDataset |
compressSimpleDataset(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 |
convertToMovingAverage(int averagepoints,
int convertMode)
Converts the current dataset to a moving average version of its former self. |
void |
copy(SimpleDataset source)
Copies the source dataset. |
int |
deleteDataPoint(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. |
double |
getAverageY()
Returns the average of the y-values in the dataset. |
ChartPoint3D |
getDataPoint(int index)
This method returns the x- and y-value of a point at the specified index. |
double |
getDatasetMax(int naxis)
This method returns the maximum value for either the xData or yData arrays. |
double |
getDatasetMin(int naxis)
This method returns the minimum value for either the xData or yData arrays. |
SimpleDataset |
getFastClipDataset(java.lang.String s,
PhysicalCoordinates transform,
int fastclipmode,
java.lang.Integer fastclipoffset)
This method returns a truncated dataset that only includes the datapoints within the current scaling limits, assuming the the data is monotonic in the x or y direction. |
int |
getFirstValidIndex()
This method returns the index of the first valid data point in a simple dataset. |
double |
getGroupDatasetSumMax(int naxis)
This method returns the maximum value for either the xData array, or the maximum of the sum across groups for each index of the yGroupData array. |
double |
getGroupDatasetSumMin(int naxis)
This method returns the minimum value for either the xData array, or the minimum of value in group #0 of the yGroupData array. |
int |
getNumberGroups()
This method returns the value of the nNumGroups field which is number of groups in a group dataset. |
double |
getSumY()
Returns the sum of the y-values in the dataset. |
double[] |
getYData()
This method returns a reference to the yData array, the array of y-values for simple datasets. |
DoubleArray |
getYDataObj()
This method returns a reference to the DoubleArray object used to store the y-data values. |
double |
getYDataValue(int index)
This method returns the y-value in a simple dataset. |
double |
getYDataValue(int group,
int index)
This method resolves the generalized getYDataValue method int the abstract ChartDataset class. |
void |
initDataset(java.lang.String sname,
double[] x,
double[] y)
an SimpleDataset initialization method that initializes the name, x- and y-data values of a simple dataset. |
void |
initDataset(java.lang.String sname,
double[] x,
double[] y,
double zvalue,
double depthvalue)
an SimpleDataset initialization method that initializes the name, x- and y-data values of a simple dataset. |
void |
initDataset(java.lang.String sname,
double[] x,
double[] y,
int n)
an SimpleDataset initialization method that initializes the name, x- and y-data values of a simple dataset. |
void |
initializeData(double[] x,
double[] y)
A SimpleDataset initialization method that initializes the x- and y-data values of a simple dataset. |
void |
initializeData(double[] x,
double[] y,
double zvalue,
double depthvalue)
A SimpleDataset initialization method that initializes the x- and y-data values of a simple dataset. |
int |
insertDataPoint(ChartPoint3D p,
int insertpoint)
Insert a data point at the specified location, increasing the size of the dataset by one. |
int |
insertDataPoint(double xvalue,
double yvalue,
int insertpoint)
Insert a data point at the specified location, increasing the size of the dataset by one. |
boolean |
insertDatapointsAtCrossover(double crossover,
int hvmode)
This methods inserts a false data point at the crossover point for a dataset. |
boolean |
isDataPointGood(int index)
This method checks if the point at the specified index for a simple dataset is valid. |
void |
readSimpleDataset(CSV csv,
java.lang.String filename,
int rowskip,
int columnskip)
This methods will open a text file and read the CSV (Comma Separated Value) formatted data values in that file. |
void |
resetBuffer()
This method resets the buffer back to its original state. |
int |
resize(int n)
Resizes the dataset, maintaining the original data. |
void |
setDataPoint(int index,
ChartPoint3D p)
Sets the x- and y-values for a data point in a simple dataset. |
void |
setDataPoint(int index,
double x,
double y)
Sets the x- and y-values for a data point in a simple dataset. |
void |
setYData(double[] yvalues)
This method sets the values of the yData array, the array of y-values for simple and group datasets. |
void |
setYData(DoubleArray yvalues)
This method sets the values of the yData array, the array of y-values for simple and group datasets. |
void |
setYDataValue(int index,
double y)
Sets the y-value in a simple dataset. |
void |
setYDataValue(int group,
int index,
double y)
This method resolves the generalized setYDataValue method int the abstract ChartDataset class. |
void |
sortByX(boolean ascending)
Sorts the array elements of the dataset using the values of the xData array as the sort key. |
void |
writeSimpleDataset(CSV csv,
java.lang.String filename)
This methods will create a text file and output the dataset to that file in a CSV (Comma Separated Value) format. |
void |
writeSimpleDataset(CSV csv,
java.lang.String filename,
boolean append)
This methods will create a text file and output the dataset to that file in a CSV (Comma Separated Value) format. |
| Methods inherited from class com.quinncurtis.chart3djava.ChartObj |
|---|
copy, getChartObjIDCntr, getChartObjType, getThisChartObjID |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleDataset(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 SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
double zvalue,
double depthvalue)
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.zvalue - Specifies the initialvalue of the implicitZValue property.depthvalue - Specifies the initialvalue of the implicitDepthValue property.
public SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
boolean[] valid)
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.valid - An array that specifies the valid values of a dataset.
public SimpleDataset(java.lang.String sname,
double[] x,
double[] y,
boolean[] valid,
int n)
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.valid - An array that specifies the valid values of a dataset.n - Specifies the number of data points to use out of the x, y and valid arrays. This
value must be less than equal to x.length.
public SimpleDataset(java.lang.String sname,
int n)
sname - Specifies the name of the dataset.n - Specifies the number of xy data point pairs in x and y.
public SimpleDataset(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 SimpleDataset()
| Method Detail |
|---|
public int errorCheck(int nerror)
errorCheck in class ChartDatasetnerror - Current error state
public void initializeData(double[] x,
double[] y)
x - An array that specifies the x-values of a dataset.y - An array the y-values of a dataset.
public void initializeData(double[] x,
double[] y,
double zvalue,
double depthvalue)
x - An array that specifies the x-values of a dataset.y - An array the y-values of a dataset.zvalue - Specifies the initialvalue of the implicitZValue property.depthvalue - Specifies the initialvalue of the implicitDepthValue property.
public void initDataset(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 the y-values of a dataset.
public void initDataset(java.lang.String sname,
double[] x,
double[] y,
double zvalue,
double depthvalue)
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.zvalue - Specifies the initialvalue of the implicitZValue property.depthvalue - Specifies the initialvalue of the implicitDepthValue property.
public void initDataset(java.lang.String sname,
double[] x,
double[] y,
int n)
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.n - Number of datapointst.
public void convertToMovingAverage(int averagepoints,
int convertMode)
averagepoints - The length of the moving average window.convertMode - The moving average can be carried out using the x-values, the y-values or
both x- and y-values. Use one the moving average constants: MOVING_AVERAGE_X, MOVING_AVERAGE_Y, or
MOVING_AVERAGE_XY.public void copy(SimpleDataset source)
source - The source dataset object.public java.lang.Object clone()
clone in class java.lang.Objectpublic int getFirstValidIndex()
public SimpleDataset getFastClipDataset(java.lang.String s,
PhysicalCoordinates transform,
int fastclipmode,
java.lang.Integer fastclipoffset)
s - A string specifying the new name of the dataset.transform - The transform that the dataset is clipped against.fastclipmode - Specifies if the data is clipped against the x-coordinate (FASTCLIP_X,
FASTCLIP_Y). )fastclipoffset - Returns the start offset of the fast clip data.
public double getDatasetMin(int naxis)
getDatasetMin in class ChartDatasetnaxis - Specifies which data array to return the minimum value from. UseX_AXIS for the
xData array, andY_AXIS for yData array.
public double getDatasetMax(int naxis)
getDatasetMax in class ChartDatasetnaxis - Specifies which data array to return the maximum value from. UseX_AXIS for the
xData array, andY_AXIS for yData array.
public double[] getYData()
public DoubleArray getYDataObj()
public void setYData(double[] yvalues)
yvalues - the new y-values.public void setYData(DoubleArray yvalues)
yvalues - the new y-values.public int getNumberGroups()
getNumberGroups in class ChartDataset
public void setDataPoint(int index,
double x,
double y)
index - Specifies the index for the new data values.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 addDataPoint(double x,
double y)
x - Specifies the new x-value for the data point to append to the end of the dataset.y - Specifies the new y-value for the data point to append to the end of the dataset.
public int addDataPoint(ChartPoint3D p)
p - Specifies the new data point to append to the end of the dataset.
public void resetBuffer()
public int resize(int n)
n - The new size of the dataset.
public int insertDataPoint(ChartPoint3D p,
int insertpoint)
p - The new data point to insert.insertpoint - 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 int insertDataPoint(double xvalue,
double yvalue,
int insertpoint)
xvalue - The x-value of the point to insert.yvalue - 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 int deleteDataPoint(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 void setDataPoint(int index,
ChartPoint3D p)
index - Specifies the index for the new data values.p - Specifies the new x- and y-values for the data point at the specified index.public ChartPoint3D getDataPoint(int index)
index - Specifies the index of the data point.
public void setYDataValue(int index,
double y)
y - Specifies the new y-value for the data point at the specified index.index - Specifies the index for the new data values.public double getYDataValue(int index)
index - Specifies the index of the y-value values.
public void setYDataValue(int group,
int index,
double y)
setYDataValue in class ChartDatasety - Specifies the new y-value for the data point at the specified index and group.group - Specifies the group for the new data value.index - Specifies the index for the new data value.
public double getYDataValue(int group,
int index)
getYDataValue in class ChartDatasetgroup - Specifies the group of the y-value.index - Specifies the index of the y-value.
public boolean isDataPointGood(int index)
isDataPointGood in class ChartDatasetindex - Specifies the index to check in the xData and yData arrays.
public boolean calcNearestPoint(PhysicalCoordinates transform,
ChartPoint3D testpoint,
int nmode,
NearestPointData nearestpoint)
calcNearestPoint in class ChartDatasettransform - The coordinate system of the test point.testpoint - The test point for the nearness calculation.nmode - Specifies the algorithm used in the nearness calculation.nearestpoint - Returns the parameters of the nearest point.
public double getSumY()
public double getAverageY()
public void combineDataset(SimpleDataset source,
int combinecoord,
int op)
source - The the data elements of the source datasets are combined with the current dataset,
element by element, using the combine operator.combinecoord - Specifies which coordinates of the two datasets are combined. Use one of the
dataset combine mode constants: COMBINE_DATASET_X, COMBINE_DATASET_Y, or COMBINE_DATASET_XY.op - Specifies how each element of the two datasets are combined. Use one of the dataset
combine operator constants: COMBINE_DATASET_ADD, COMBINE_DATASET_SUBTRACT, COMBINE_DATASET_MUTLIPLY or
COMBINE_DATASET_DIVIDE.public double getGroupDatasetSumMax(int naxis)
getGroupDatasetSumMax in class ChartDatasetnaxis - Specifies which data array to return the maximum value from. UseX_AXIS for the
xData array, andY_AXIS for the yGroupData array.
public double getGroupDatasetSumMin(int naxis)
getGroupDatasetSumMin in class ChartDatasetnaxis - Specifies which data array to return the minimum value from. UseX_AXIS for the
xData array, andY_AXIS for the yGroupData array.
public void sortByX(boolean ascending)
ascending - Specify true to sort the dataset array elements so that the values of the
xData array start at the minimum value and end at the maximum value.
public boolean checkValidDataX(PhysicalCoordinates transform,
int index)
transform - Specifies the coordinate system being used to plot the data.index - Specifies the index to check in the xData array.
public boolean checkValidDataY(PhysicalCoordinates transform,
int index)
transform - Specifies the coordinate system being used to plot the data.index - Specifies the index to check in the yData array.
public boolean checkValidData(PhysicalCoordinates transform,
int index)
transform - Specifies the coordinate system being used to plot the data.index - Specifies the index to check in the group data arrays.
public void writeSimpleDataset(CSV csv,
java.lang.String filename)
csv - An instance of an CSV object.filename - The name of the file.
public void writeSimpleDataset(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.
public void readSimpleDataset(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 SimpleDataset compressSimpleDataset(int ctypex,
int ctypey,
int interval,
int startindex,
int endindex,
java.lang.String newname)
ctypex - The compression type for the x-values. 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 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 boolean insertDatapointsAtCrossover(double crossover,
int hvmode)
crossover - The crossover value.hvmode - Specifies the horizontal or vertical mode.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||