|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.data.DatasetUtilities
A collection of useful static methods relating to datasets.
Method Summary | |
static double |
calculatePieDatasetTotal(PieDataset dataset)
Calculates the total of all the values in a PieDataset . |
static CategoryDataset |
createCategoryDataset(java.lang.String[] rowKeys,
java.lang.String[] columnKeys,
double[][] data)
Creates a CategoryDataset that contains a copy of the data in an array
(instances of Double are created to represent the data items). |
static CategoryDataset |
createCategoryDataset(java.lang.String rowKey,
KeyedValues rowData)
Creates a CategoryDataset by copying the data from the supplied KeyedValues
instance. |
static CategoryDataset |
createCategoryDataset(java.lang.String rowKeyPrefix,
java.lang.String columnKeyPrefix,
double[][] data)
Creates a CategoryDataset that contains a copy of the data in an array
(instances of Double are created to represent the data items). |
static CategoryDataset |
createCategoryDataset(java.lang.String rowKeyPrefix,
java.lang.String columnKeyPrefix,
java.lang.Number[][] data)
Creates a CategoryDataset that contains a copy of the data in an array. |
static java.lang.Number[] |
createNumberArray(double[] data)
Constructs an array of Number objects from an array of double
primitives. |
static java.lang.Number[][] |
createNumberArray2D(double[][] data)
Constructs an array of arrays of Number objects from a corresponding
structure containing double primitives. |
static PieDataset |
createPieDatasetForColumn(CategoryDataset data,
java.lang.Comparable columnKey)
Creates a pie dataset from a table dataset by taking all the values for a single column. |
static PieDataset |
createPieDatasetForColumn(CategoryDataset data,
int column)
Creates a pie dataset from a table dataset by taking all the values for a single column. |
static PieDataset |
createPieDatasetForRow(CategoryDataset data,
java.lang.Comparable rowKey)
Creates a pie dataset from a table dataset by taking all the values for a single row. |
static PieDataset |
createPieDatasetForRow(CategoryDataset data,
int row)
Creates a pie dataset from a table dataset by taking all the values for a single row. |
static Range |
getCumulativeRangeExtent(CategoryDataset dataset)
Calculates the range of values for a dataset where each item is the running total of the items for the current series. |
static Range |
getDomainExtent(Dataset dataset)
Returns the range of values in the domain for the dataset. |
static java.lang.Number |
getMaximumDomainValue(Dataset data)
Returns the maximum domain value for the specified dataset. |
static java.lang.Number |
getMaximumRangeValue(Dataset data)
Returns the maximum range value for the specified dataset. |
static java.lang.Number |
getMaximumStackedRangeValue(CategoryDataset data)
Returns the maximum value in the dataset range, assuming that values in each category are "stacked". |
static java.lang.Number |
getMinimumDomainValue(Dataset data)
Returns the minimum domain value for the specified dataset. |
static java.lang.Number |
getMinimumRangeValue(Dataset data)
Returns the minimum range value for the specified dataset. |
static java.lang.Number |
getMinimumStackedRangeValue(CategoryDataset data)
Returns the minimum value in the dataset range, assuming that values in each category are "stacked". |
static Range |
getRangeExtent(Dataset data)
Returns the range of values in the range for the dataset. |
static Range |
getStackedRangeExtent(CategoryDataset data)
Returns the minimum and maximum values for the dataset's range (as in domain/range), assuming that the series in one category are stacked. |
static Range |
getStackedRangeExtent(CategoryDataset dataset,
KeyToGroupMap map)
Returns the minimum and maximum values for the dataset's range (as in domain/range), assuming that the series in one category are stacked. |
static Range |
getStackedRangeExtent(TableXYDataset data)
Returns the minimum and maximum values for the dataset's range, assuming that the series are stacked. |
static boolean |
isEmptyOrNull(CategoryDataset data)
Returns true if the dataset is empty (or null ), and
false otherwise. |
static boolean |
isEmptyOrNull(PieDataset dataset)
Returns true if the dataset is empty (or null ), and
false otherwise. |
static boolean |
isEmptyOrNull(XYDataset data)
Returns true if the dataset is empty (or null ), and
false otherwise. |
static Range |
iterateCategoryRangeExtent(CategoryDataset data)
Iterates over the data item of the category dataset to find the range extent. |
static Range |
iterateDomainExtent(XYDataset data)
Iterates over the data item of the xy dataset to find the domain extent. |
static Range |
iterateXYRangeExtent(XYDataset data)
Iterates over the data item of the xy dataset to find the range extent. |
static PieDataset |
limitPieDataset(PieDataset dataset,
double percentThreshold)
Creates an "Other" slice for percentages below the percent threshold. |
static PieDataset |
limitPieDataset(PieDataset dataset,
double percentThreshold,
int minItems)
Create an "Other" slice for percentages below the percent threshold providing there are more slices below the percent threshold than specified in the slice threshold. |
static PieDataset |
limitPieDataset(PieDataset dataset,
double percentThreshold,
int minItems,
java.lang.Comparable key)
Creates a new pie dataset based on the supplied dataset, but modified by aggregating all the low value items (those whose value is lower than the percentThreshold) into a single item. |
static XYDataset |
sampleFunction2D(Function2D f,
double start,
double end,
int samples,
java.lang.String seriesName)
Creates an XYDataset by sampling the specified function over a fixed range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.Number[] createNumberArray(double[] data)
Number
objects from an array of double
primitives.
data
- the data.
Double
.public static java.lang.Number[][] createNumberArray2D(double[][] data)
Number
objects from a corresponding
structure containing double
primitives.
data
- the data.
Double
.public static Range getDomainExtent(Dataset dataset)
If the supplied dataset is null
, the range returned is null
.
dataset
- the dataset (null
permitted).
null
).public static Range iterateDomainExtent(XYDataset data)
data
- the xy dataset to iterate over.
public static Range getRangeExtent(Dataset data)
data
- the dataset.
public static Range iterateCategoryRangeExtent(CategoryDataset data)
data
- the category dataset to iterate over.
public static Range iterateXYRangeExtent(XYDataset data)
data
- the xy dataset to iterate over.
public static java.lang.Number getMinimumDomainValue(Dataset data)
This is easy if the dataset implements the DomainInfo interface (a good idea if there is an efficient way to determine the minimum value). Otherwise, it involves iterating over the entire data-set.
Returns null if all the data values in the dataset are null.
data
- the dataset.
public static java.lang.Number getMaximumDomainValue(Dataset data)
This is easy if the dataset implements the DomainInfo interface (a good idea if there is an efficient way to determine the maximum value). Otherwise, it involves iterating over the entire data-set.
Returns null if all the data values in the dataset are null.
data
- the dataset.
public static java.lang.Number getMinimumRangeValue(Dataset data)
This is easy if the dataset implements the RangeInfo interface (a good idea if there is an efficient way to determine the minimum value). Otherwise, it involves iterating over the entire data-set.
Returns null if all the data values in the dataset are null.
data
- the dataset.
public static java.lang.Number getMaximumRangeValue(Dataset data)
This is easy if the dataset implements the RangeInfo interface (a good idea if there is an efficient way to determine the maximum value). Otherwise, it involves iterating over the entire data-set.
Returns null if all the data values are null.
data
- the dataset.
public static PieDataset createPieDatasetForRow(CategoryDataset data, java.lang.Comparable rowKey)
data
- the data.rowKey
- the row key.
public static PieDataset createPieDatasetForRow(CategoryDataset data, int row)
data
- the data.row
- the row (zero-based index).
public static PieDataset createPieDatasetForColumn(CategoryDataset data, java.lang.Comparable columnKey)
data
- the data.columnKey
- the column key.
public static PieDataset createPieDatasetForColumn(CategoryDataset data, int column)
data
- the data.column
- the column (zero-based index).
public static double calculatePieDatasetTotal(PieDataset dataset)
PieDataset
. If the dataset contains
negative or null
values, they are ignored.
dataset
- the dataset (null
not permitted).
public static Range getStackedRangeExtent(CategoryDataset data)
data
- the dataset.
public static Range getStackedRangeExtent(CategoryDataset dataset, KeyToGroupMap map)
dataset
- the dataset.map
- a structure that maps series to groups.
public static java.lang.Number getMinimumStackedRangeValue(CategoryDataset data)
data
- the dataset.
public static java.lang.Number getMaximumStackedRangeValue(CategoryDataset data)
data
- the dataset (null
permitted).
null
).public static XYDataset sampleFunction2D(Function2D f, double start, double end, int samples, java.lang.String seriesName)
XYDataset
by sampling the specified function over a fixed range.
f
- the function (null
not permitted).start
- the start value for the range.end
- the end value for the range.samples
- the number of sample points (must be > 1).seriesName
- the name to give the resulting series (null
not permitted).
public static CategoryDataset createCategoryDataset(java.lang.String rowKeyPrefix, java.lang.String columnKeyPrefix, double[][] data)
CategoryDataset
that contains a copy of the data in an array
(instances of Double
are created to represent the data items).
Row and column keys are created by appending 0, 1, 2, ... to the supplied prefixes.
rowKeyPrefix
- the row key prefix.columnKeyPrefix
- the column key prefix.data
- the data.
public static CategoryDataset createCategoryDataset(java.lang.String rowKeyPrefix, java.lang.String columnKeyPrefix, java.lang.Number[][] data)
CategoryDataset
that contains a copy of the data in an array.
Row and column keys are created by appending 0, 1, 2, ... to the supplied prefixes.
rowKeyPrefix
- the row key prefix.columnKeyPrefix
- the column key prefix.data
- the data.
public static CategoryDataset createCategoryDataset(java.lang.String[] rowKeys, java.lang.String[] columnKeys, double[][] data)
CategoryDataset
that contains a copy of the data in an array
(instances of Double
are created to represent the data items).
Row and column keys are taken from the supplied arrays.
rowKeys
- the row keys.columnKeys
- the column keys.data
- the data.
public static CategoryDataset createCategoryDataset(java.lang.String rowKey, KeyedValues rowData)
CategoryDataset
by copying the data from the supplied KeyedValues
instance.
rowKey
- the row key.rowData
- the row data.
public static boolean isEmptyOrNull(XYDataset data)
true
if the dataset is empty (or null
), and
false
otherwise.
data
- the dataset (null
permitted).
public static boolean isEmptyOrNull(PieDataset dataset)
true
if the dataset is empty (or null
), and
false
otherwise.
dataset
- the dataset (null
permitted).
public static boolean isEmptyOrNull(CategoryDataset data)
true
if the dataset is empty (or null
), and
false
otherwise.
data
- the dataset (null
permitted).
public static PieDataset limitPieDataset(PieDataset dataset, double percentThreshold)
dataset
- the PieDataset.percentThreshold
- the percent threshold.
public static PieDataset limitPieDataset(PieDataset dataset, double percentThreshold, int minItems)
dataset
- the source dataset.percentThreshold
- the percent threshold (ten percent is 0.10).minItems
- only aggregate low values if there are at least this many.
public static PieDataset limitPieDataset(PieDataset dataset, double percentThreshold, int minItems, java.lang.Comparable key)
dataset
- the source dataset.percentThreshold
- the percent threshold (ten percent is 0.10).minItems
- only aggregate low values if there are at least this many.key
- the key to represent the aggregated items.
public static Range getStackedRangeExtent(TableXYDataset data)
data
- the dataset.
public static Range getCumulativeRangeExtent(CategoryDataset dataset)
dataset
- the dataset.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |