|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sourceforge.chart2d.Dataset
The container for the data values to chart.
A dataset is like a third order array (ex. float[][][]). The first order is
the "sets" order. A set contains data divided by category. The "sets" refer
to the objects described by the legend labels, if a legend exists. The
second order is the "cats" or categories order. Data within a set can be
divided by category. A category can have multiple data items. If using a
graph chart, the categories are described by the labels-axis labels. For pie
charts, there is only one category. The third order is the "items" order.
The "items" order are the values for a particular category and set.
For example, if we had data for the years 1999 and 2000 of how many units were
sold on each day during that time, then one way to chart this would be using
a graph chart and making the years correspond to the "sets" order, "months",
correspond to the "cats" order, and the number of units sold per day
correspond to the "items" order.
There are two important rules to
mention about this. For each set, the number of cats must be the same. For
each cat, the number of items must be the same. In our example, we would
probably want to choose the number of items per category to be 30,
corresponding the average number of days per month. For months with less
than thirty days, we would populate the unfilled days with the average of the
filled days or simply carry the last value of the filled days into the
unfilled days. For months with more than thirty days, we would average the
last two days, and use that value as the value of the last day.
If passing to a PieChart2DProperties, the value used for each pie sector is
the sum of the values in each set of data.
Pass this to any number of PieChart2D or GraphChart2D objects.
| Constructor Summary | |
Dataset()
Creates a dataset with 0 sets, 0 categories, and 0 items. |
|
Dataset(net.sourceforge.chart2d.Dataset dataset)
Creates a dataset that is a copy of another dataset. |
|
Dataset(int sets,
int cats,
int items)
Creates a dataset with the specified number of sets, categories per set, and items per set and per category. |
|
| Method Summary | |
void |
add(int set,
int cat,
int item,
float value)
Adds a value to the dataset increasing its internal data structure if necessary. |
void |
addMovingAverage(net.sourceforge.chart2d.Dataset dataset,
int scope)
Analyzes the (input) dataset and adds moving average trend data to this dataset. |
void |
doConvertToStacked()
Converts the dataset for use in "stacked" charts. |
void |
doShiftLower(float[] values)
Shifts all the data items one place, from the higher order to the lower order, replacing the highest order items with the specified items. |
float |
get(int set,
int cat,
int item)
Gets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category. |
float |
getAverage(int set,
int cat,
int item)
Gets the average of some set of numbers. |
float |
getGreatest()
Gets the greatest value of all the data in the datset. |
float |
getLeast()
Gets the least value of all the data in the datset. |
int |
getNumCats()
Gets the number of categories per set of data in this dataset. |
int |
getNumItems()
Gets the number of items per category of data in this dataset. |
int |
getNumSets()
Gets the number of sets of data in this dataset. |
void |
remove(int set,
int cat,
int item)
Removes values from the dataset. |
void |
set(net.sourceforge.chart2d.Dataset dataset)
Sets all the values of this dataset from another Dataset. |
void |
set(int set,
int cat,
int item,
float value)
Sets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category. |
void |
setDatasetToDefaults()
Sets the dataset to its default state. |
void |
setMovingAverage(int set,
net.sourceforge.chart2d.Dataset dataset,
int scope)
Analyzes the (input) dataset and sets moving average trend data to this dataset. |
void |
setSize(int sets,
int cats,
int items)
Resets the size of the dataset. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Dataset()
public Dataset(int sets,
int cats,
int items)
sets - The number of sets.cats - The number of categories per set.items - The number of items per category and per set.public Dataset(net.sourceforge.chart2d.Dataset dataset)
dataset - The dataset to copy.| Method Detail |
public final void setDatasetToDefaults()
public final void set(int set,
int cat,
int item,
float value)
set - The specified set of the variable.cat - The specified cat of the variable.item - The specified item of the variable.value - The specified value of the variable.public final void set(net.sourceforge.chart2d.Dataset dataset)
dataset - The Dataset to copy.
public final void setSize(int sets,
int cats,
int items)
sets - The number of sets.cats - The number of categories per set.items - The number of items per category and per set.
public final float get(int set,
int cat,
int item)
set - The specified set of the variable.cat - The specified cat of the variable.item - The specified item of the variable.
public final int getNumSets()
public final int getNumCats()
public final int getNumItems()
public final float getGreatest()
public final float getLeast()
public final float getAverage(int set,
int cat,
int item)
set - Which particular set or -1 for all.cat - Which particular cat or -1 for all.item - Which particular item or -1 for all.
public final void add(int set,
int cat,
int item,
float value)
set - The specified set of the variable.cat - The specified cat of the variable.item - The specified item of the variable.value - The specified value of the variable.
public final void addMovingAverage(net.sourceforge.chart2d.Dataset dataset,
int scope)
dataset - The dataset to analyze.scope - The number of data points to compute over.
public final void setMovingAverage(int set,
net.sourceforge.chart2d.Dataset dataset,
int scope)
set - The set into this dataset to put the moving average.dataset - The dataset to analyze.scope - The number of data points to compute over.
public final void remove(int set,
int cat,
int item)
set - The set of data within which data is to be removed.cat - The cat of data within which data is to be removed.item - The item of data that is to be removed.public final void doShiftLower(float[] values)
values - An array of values of length getNumSets() to shift in.public final void doConvertToStacked()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||