java.lang.Object
org.jfree.chart3d.data.DataUtils
Some utility methods for working with the various datasets and data
structures available in Orson Charts.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Comparable<S>>
intcount(KeyedValues3D<S, ?, ?, ?> data, S seriesKey) Returns the count of the non-nullentries in the dataset for the specified series.static <C extends Comparable<C>>
intcountForColumn(KeyedValues3D<?, ?, C, ?> data, C columnKey) Returns the count of the non-nullentries in the dataset for the specified column (all series).static <R extends Comparable<R>>
intcountForRow(KeyedValues3D<?, R, ?, ?> data, R rowKey) Returns the count of the non-nullentries in the dataset for the specified row (all series).static <S extends Comparable<S>,R extends Comparable<R>, C extends Comparable<C>>
XYZDataset<S> extractXYZDatasetFromColumns(KeyedValues3D<S, R, C, ? extends Number> source, C xColKey, C yColKey, C zColKey) Creates anXYZDatasetby extracting values from specified columns in aKeyedValues3Dinstance, across all the available rows (items where any of the x, y or z values isnullare skipped).static <S extends Comparable<S>,R extends Comparable<R>, C extends Comparable<C>>
XYZDataset<S> extractXYZDatasetFromColumns(KeyedValues3D<S, R, C, ? extends Number> source, C xColKey, C yColKey, C zColKey, NullConversion nullConversion, List<KeyedValues3DItemKey> exceptions) Creates anXYZDatasetby extracting values from specified columns in aKeyedValues3Dinstance.static <S extends Comparable<S>,R extends Comparable<R>, C extends Comparable<C>>
XYZDatasetextractXYZDatasetFromRows(KeyedValues3D<S, R, C, ? extends Number> source, R xRowKey, R yRowKey, R zRowKey) Creates anXYZDatasetby extracting values from specified rows in aKeyedValues3Dinstance, across all the available columns (items where any of the x, y or z values isnullare skipped).static <S extends Comparable<S>,R extends Comparable<R>, C extends Comparable<C>>
XYZDatasetextractXYZDatasetFromRows(KeyedValues3D<S, R, C, ? extends Number> source, R xRowKey, R yRowKey, R zRowKey, NullConversion nullConversion, List<KeyedValues3DItemKey> exceptions) Creates anXYZDatasetby extracting values from specified rows in aKeyedValues3Dinstance.static RangefindStackedValueRange(Values3D<? extends Number> data) Finds the range of values in the dataset considering that each series is stacked on top of the other.static RangefindStackedValueRange(Values3D<? extends Number> data, double base) Finds the range of values in the dataset considering that each series is stacked on top of the others, starting at the base value.static RangefindValueRange(Values3D<? extends Number> data) Returns the range of values in the specified data structure (a three dimensional cube).static RangefindValueRange(Values3D<? extends Number> data, double base) Returns the range of values in the specified data cube, ornullif there is no data.static RangefindValueRange(Values3D<? extends Number> data, double base, boolean finite) /** Returns the range of values in the specified data cube, ornullif there is no data.static RangefindXRange(XYZDataset dataset) Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values).static RangefindXRange(XYZDataset dataset, double inc) Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static RangefindXRange(XYZDataset dataset, double inc, boolean finite) Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static RangefindYRange(XYZDataset dataset) Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values).static RangefindYRange(XYZDataset dataset, double inc) Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static RangefindYRange(XYZDataset dataset, double inc, boolean finite) Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static RangefindZRange(XYZDataset dataset) Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values).static RangefindZRange(XYZDataset dataset, double inc) Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static RangefindZRange(XYZDataset dataset, double inc, boolean finite) Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues).static double[]stackSubTotal(Values3D<? extends Number> data, double base, int series, int row, int column) Returns the positive and negative subtotals of the values for all the series preceding the specified series.static <S extends Comparable<S>>
doubletotal(KeyedValues3D<S, ?, ?, ? extends Number> data, S seriesKey) Returns the total of the non-nullvalues in the dataset for the specified series.static doubleReturns the total of the values in the list.static <S extends Comparable<S>>
doubletotal(XYZDataset<S> data, S seriesKey) Returns the total of the non-NaNentries in the dataset for the specified series.static <C extends Comparable<C>>
doubletotalForColumn(KeyedValues3D<?, ?, C, ? extends Number> data, C columnKey) Returns the total of the non-nullentries in the dataset for the specified column (all series).static <R extends Comparable<R>>
doubletotalForRow(KeyedValues3D<?, R, ?, ? extends Number> data, R rowKey) Returns the total of the non-nullentries in the dataset for the specified row (all series).
-
Method Details
-
total
Returns the total of the values in the list. Anynullvalues are ignored.- Parameters:
values- the values (nullnot permitted).- Returns:
- The total of the values in the list.
-
count
Returns the count of the non-nullentries in the dataset for the specified series. AnIllegalArgumentExceptionis thrown if theseriesKeyis not present in the data.- Type Parameters:
S- the series key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).seriesKey- the series key (nullnot permitted).- Returns:
- The count.
- Since:
- 1.2
-
countForRow
Returns the count of the non-nullentries in the dataset for the specified row (all series).- Type Parameters:
R- the row key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).rowKey- the row key (nullnot permitted).- Returns:
- The count.
- Since:
- 1.2
-
countForColumn
public static <C extends Comparable<C>> int countForColumn(KeyedValues3D<?, ?, C, ?> data, C columnKey) Returns the count of the non-nullentries in the dataset for the specified column (all series).- Type Parameters:
C- the column key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).columnKey- the column key (nullnot permitted).- Returns:
- The count.
- Since:
- 1.2
-
total
public static <S extends Comparable<S>> double total(KeyedValues3D<S, ?, ?, ? extends Number> data, S seriesKey) Returns the total of the non-nullvalues in the dataset for the specified series. If there is no series with the specified key, this method will throw anIllegalArgumentException.- Type Parameters:
S- the series key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).seriesKey- the series key (nullnot permitted).- Returns:
- The total.
- Since:
- 1.2
-
totalForRow
public static <R extends Comparable<R>> double totalForRow(KeyedValues3D<?, R, ?, ? extends Number> data, R rowKey) Returns the total of the non-nullentries in the dataset for the specified row (all series).- Type Parameters:
R- the row key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).rowKey- the row key (nullnot permitted).- Returns:
- The total.
- Since:
- 1.2
-
totalForColumn
public static <C extends Comparable<C>> double totalForColumn(KeyedValues3D<?, ?, C, ? extends Number> data, C columnKey) Returns the total of the non-nullentries in the dataset for the specified column (all series).- Type Parameters:
C- the column key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).columnKey- the row key (nullnot permitted).- Returns:
- The total.
- Since:
- 1.2
-
findValueRange
Returns the range of values in the specified data structure (a three dimensional cube). If there is no data, this method returnsnull.- Parameters:
data- the data (nullnot permitted).- Returns:
- The range of data values (possibly
null).
-
findValueRange
Returns the range of values in the specified data cube, ornullif there is no data. The range will be expanded, if required, to include thebasevalue (unless it isDouble.NaNin which case it is ignored).- Parameters:
data- the data (nullnot permitted).base- a value that must be included in the range (often 0). This argument is ignored if it isDouble.NaN.- Returns:
- The range (possibly
null).
-
findValueRange
/** Returns the range of values in the specified data cube, ornullif there is no data. The range will be expanded, if required, to include thebasevalue (unless it isDouble.NaNin which case it is ignored).- Parameters:
data- the data (nullnot permitted).base- a value that must be included in the range (often 0). This argument is ignored if it isDouble.NaN.finite- iftrueinfinite values will be ignored.- Returns:
- The range (possibly
null). - Since:
- 1.4
-
findStackedValueRange
Finds the range of values in the dataset considering that each series is stacked on top of the other.- Parameters:
data- the data (nullnot permitted).- Returns:
- The range.
-
findStackedValueRange
Finds the range of values in the dataset considering that each series is stacked on top of the others, starting at the base value.- Parameters:
data- the data values (nullnot permitted).base- the base value.- Returns:
- The range.
-
stackSubTotal
public static double[] stackSubTotal(Values3D<? extends Number> data, double base, int series, int row, int column) Returns the positive and negative subtotals of the values for all the series preceding the specified series.
One application for this method is to compute the base values for individual bars in a stacked bar chart.- Parameters:
data- the data (nullnot permitted).base- the initial base value (normally0.0, but the values can be stacked from a different starting point).series- the index of the current series (series with lower indices are included in the sub-totals).row- the row index of the required item.column- the column index of the required item.- Returns:
- The subtotals, where
result[0]is the subtotal of the negative data items, andresult[1]is the subtotal of the positive data items.
-
total
Returns the total of the non-NaNentries in the dataset for the specified series.- Type Parameters:
S- the series key (must implement Comparable).- Parameters:
data- the dataset (nullnot permitted).seriesKey- the series key (nullnot permitted).- Returns:
- The count.
- Since:
- 1.2
-
findXRange
Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values). If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
findXRange
Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). Infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional x-value to include.- Returns:
- The range (possibly
null).
-
findXRange
Returns the range of x-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). If thefiniteflag is set, infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional x-value to include.finite- a flag indicating whether to exclude infinite values.- Returns:
- The range (possibly
null). - Since:
- 1.4
-
findYRange
Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values). If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range.
-
findYRange
Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). Infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional x-value to include.- Returns:
- The range.
-
findYRange
Returns the range of y-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). If thefiniteflag is set, infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional y-value to include.finite- a flag indicating whether to exclude infinite values.- Returns:
- The range (possibly
null). - Since:
- 1.4
-
findZRange
Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNand infinite values). If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
findZRange
Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). Infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional x-value to include.- Returns:
- The range (possibly
null).
-
findZRange
Returns the range of z-values in the dataset by iterating over all values (and ignoringDouble.NaNvalues). The range will be extended if necessary to includeinc(unless it isDouble.NaNin which case it is ignored). If thefiniteflag is set, infinite values in the dataset will be ignored. If there are no values eligible for inclusion in the range, this method returnsnull.- Parameters:
dataset- the dataset (nullnot permitted).inc- an additional z-value to include.finite- a flag indicating whether to exclude infinite values.- Returns:
- The range (possibly
null). - Since:
- 1.4
-
extractXYZDatasetFromRows
public static <S extends Comparable<S>,R extends Comparable<R>, XYZDataset extractXYZDatasetFromRowsC extends Comparable<C>> (KeyedValues3D<S, R, C, ? extends Number> source, R xRowKey, R yRowKey, R zRowKey) Creates anXYZDatasetby extracting values from specified rows in aKeyedValues3Dinstance, across all the available columns (items where any of the x, y or z values isnullare skipped). The new dataset contains a copy of the data and is completely independent of thesourcedataset.
Note thatCategoryDataset3Dis an extension ofKeyedValues3Dso you can use this method for any implementation of theCategoryDataset3Dinterface.- Type Parameters:
S- the series key (must implement Comparable).R- the row key (must implement Comparable).C- the column key (must implement Comparable).- Parameters:
source- the source data (nullnot permitted).xRowKey- the row key for x-values (nullnot permitted).yRowKey- the row key for y-values (nullnot permitted).zRowKey- the row key for z-values (nullnot permitted).- Returns:
- A new dataset.
- Since:
- 1.3
-
extractXYZDatasetFromRows
public static <S extends Comparable<S>,R extends Comparable<R>, XYZDataset extractXYZDatasetFromRowsC extends Comparable<C>> (KeyedValues3D<S, R, C, ? extends Number> source, R xRowKey, R yRowKey, R zRowKey, NullConversion nullConversion, List<KeyedValues3DItemKey> exceptions) Creates anXYZDatasetby extracting values from specified rows in aKeyedValues3Dinstance. The new dataset contains a copy of the data and is completely independent of thesourcedataset. Note thatCategoryDataset3Dis an extension ofKeyedValues3D.
Special handling is provided for items that containnullvalues. The caller may pass in anexceptionslist ( normally empty) that will be populated with the keys of the items that receive special handling, if any.- Type Parameters:
S- the series key (must implement Comparable).R- the row key (must implement Comparable).C- the column key (must implement Comparable).- Parameters:
source- the source data (nullnot permitted).xRowKey- the row key for x-values (nullnot permitted).yRowKey- the row key for y-values (nullnot permitted).zRowKey- the row key for z-values (nullnot permitted).nullConversion- specifies the treatment fornullvalues in the dataset (nullnot permitted).exceptions- a list that, if not null, will be populated with keys for the items in the source dataset that containnullvalues (nullpermitted).- Returns:
- A new dataset.
- Since:
- 1.3
-
extractXYZDatasetFromColumns
public static <S extends Comparable<S>,R extends Comparable<R>, XYZDataset<S> extractXYZDatasetFromColumnsC extends Comparable<C>> (KeyedValues3D<S, R, C, ? extends Number> source, C xColKey, C yColKey, C zColKey) Creates anXYZDatasetby extracting values from specified columns in aKeyedValues3Dinstance, across all the available rows (items where any of the x, y or z values isnullare skipped). The new dataset contains a copy of the data and is completely independent of thesourcedataset.
Note thatCategoryDataset3Dis an extension ofKeyedValues3Dso you can use this method for any implementation of theCategoryDataset3Dinterface.- Type Parameters:
S- the series key (must implement Comparable).R- the row key (must implement Comparable).C- the column key (must implement Comparable).- Parameters:
source- the source data (nullnot permitted).xColKey- the column key for x-values (nullnot permitted).yColKey- the column key for y-values (nullnot permitted).zColKey- the column key for z-values (nullnot permitted).- Returns:
- A new dataset.
- Since:
- 1.3
-
extractXYZDatasetFromColumns
public static <S extends Comparable<S>,R extends Comparable<R>, XYZDataset<S> extractXYZDatasetFromColumnsC extends Comparable<C>> (KeyedValues3D<S, R, C, ? extends Number> source, C xColKey, C yColKey, C zColKey, NullConversion nullConversion, List<KeyedValues3DItemKey> exceptions) Creates anXYZDatasetby extracting values from specified columns in aKeyedValues3Dinstance. The new dataset contains a copy of the data and is completely independent of thesourcedataset. Note thatCategoryDataset3Dis an extension ofKeyedValues3D.
Special handling is provided for items that containnullvalues. The caller may pass in anexceptionslist ( normally empty) that will be populated with the keys of the items that receive special handling, if any.- Type Parameters:
S- the series key (must implement Comparable).R- the row key (must implement Comparable).C- the column key (must implement Comparable).- Parameters:
source- the source data (nullnot permitted).xColKey- the column key for x-values (nullnot permitted).yColKey- the column key for y-values (nullnot permitted).zColKey- the column key for z-values (nullnot permitted).nullConversion- specifies the treatment fornullvalues in the dataset (nullnot permitted).exceptions- a list that, if not null, will be populated with keys for the items in the source dataset that containnullvalues (nullpermitted).- Returns:
- A new dataset.
- Since:
- 1.3
-