- java.lang.Object
-
- org.jfree.data.general.DatasetUtils
-
public final class DatasetUtils extends Object
A collection of useful static methods relating to datasets.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K extends Comparable<K>>
doublecalculatePieDatasetTotal(PieDataset<K> dataset)Calculates the total of all the values in aPieDataset.static <S extends Comparable<S>>
doublecalculateStackTotal(TableXYDataset<S> dataset, int item)Calculates the total for the y-values in all series for a given item index.static CategoryDataset<String,String>createCategoryDataset(String rowKeyPrefix, String columnKeyPrefix, double[][] data)Creates aCategoryDatasetthat contains a copy of the data in an array (instances ofdoubleare created to represent the data items).static CategoryDataset<String,String>createCategoryDataset(String rowKeyPrefix, String columnKeyPrefix, Number[][] data)Creates aCategoryDatasetthat contains a copy of the data in an array.static <R extends Comparable<R>,C extends Comparable<C>>
CategoryDataset<R,C>createCategoryDataset(R[] rowKeys, C[] columnKeys, double[][] data)Creates aCategoryDatasetthat contains a copy of the data in an array (instances ofdoubleare created to represent the data items).static <R extends Comparable<R>,C extends Comparable<C>>
CategoryDataset<R,C>createCategoryDataset(R rowKey, KeyedValues<C> rowData)Creates aCategoryDatasetby copying the data from the suppliedKeyedValuesinstance.static <K extends Comparable<K>>
PieDataset<K>createConsolidatedPieDataset(PieDataset<K> source, K key, double minimumPercent)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 thepercentThreshold) into a single item with the key "Other".static <K extends Comparable<K>>
PieDataset<K>createConsolidatedPieDataset(PieDataset<K> source, K key, double minimumPercent, int minItems)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 thepercentThreshold) into a single item.static <R extends Comparable<R>,C extends Comparable<C>>
PieDataset<R>createPieDatasetForColumn(CategoryDataset<R,C> dataset, int column)Creates a pie dataset from aCategoryDatasetby taking all the values for a single column.static <R extends Comparable<R>,C extends Comparable<C>>
PieDataset<R>createPieDatasetForColumn(CategoryDataset<R,C> dataset, C columnKey)Creates a pie dataset from a table dataset by taking all the values for a single column.static <R extends Comparable<R>,C extends Comparable<C>>
PieDataset<C>createPieDatasetForRow(CategoryDataset<R,C> dataset, int row)Creates a pie dataset from a table dataset by taking all the values for a single row.static <R extends Comparable<R>,C extends Comparable<C>>
PieDataset<C>createPieDatasetForRow(CategoryDataset<R,C> dataset, R rowKey)Creates a pie dataset from a table dataset by taking all the values for a single row.static <R extends Comparable<R>,C extends Comparable<C>>
RangefindCumulativeRangeBounds(CategoryDataset<R,C> dataset)Calculates the range of values for a dataset where each item is the running total of the items for the current series.static <S extends Comparable<S>>
RangefindDomainBounds(XYDataset<S> dataset)Returns the range of values in the domain (x-values) of a dataset.static <S extends Comparable<S>>
RangefindDomainBounds(XYDataset<S> dataset, boolean includeInterval)Returns the range of values in the domain (x-values) of a dataset.static <S extends Comparable<S>>
RangefindDomainBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, boolean includeInterval)Returns the bounds of the x-values in the specifieddatasettaking into account only the visible series and including any x-interval if requested.static <S extends Comparable<S>>
int[]findItemIndicesForX(XYDataset<S> dataset, int series, double x)Finds the indices of the the items in the dataset that span the specified x-value.static <S extends Comparable<S>>
NumberfindMaximumDomainValue(XYDataset<S> dataset)Returns the maximum domain value for the specified dataset.static <R extends Comparable<R>,C extends Comparable<C>>
NumberfindMaximumRangeValue(CategoryDataset<R,C> dataset)Returns the maximum range value for the specified dataset.static <S extends Comparable<S>>
NumberfindMaximumRangeValue(XYDataset<S> dataset)Returns the maximum range value for the specified dataset.static <R extends Comparable<R>,C extends Comparable<C>>
NumberfindMaximumStackedRangeValue(CategoryDataset<R,C> dataset)Returns the maximum value in the dataset range, assuming that values in each category are "stacked".static <S extends Comparable<S>>
NumberfindMinimumDomainValue(XYDataset<S> dataset)Finds the minimum domain (or X) value for the specified dataset.static <R extends Comparable<R>,C extends Comparable<C>>
NumberfindMinimumRangeValue(CategoryDataset<R,C> dataset)Returns the minimum range value for the specified dataset.static <S extends Comparable<S>>
NumberfindMinimumRangeValue(XYDataset<S> dataset)Returns the minimum range value for the specified dataset.static <R extends Comparable<R>,C extends Comparable<C>>
NumberfindMinimumStackedRangeValue(CategoryDataset<R,C> dataset)Returns the minimum value in the dataset range, assuming that values in each category are "stacked".static <R extends Comparable<R>,C extends Comparable<C>>
RangefindRangeBounds(CategoryDataset<R,C> dataset)Returns the range of values in the range for the dataset.static <R extends Comparable<R>,C extends Comparable<C>>
RangefindRangeBounds(CategoryDataset<R,C> dataset, boolean includeInterval)Returns the range of values in the range for the dataset.static <R extends Comparable<R>,C extends Comparable<C>>
RangefindRangeBounds(CategoryDataset<R,C> dataset, List<R> visibleSeriesKeys, boolean includeInterval)Finds the bounds of the y-values in the specified dataset, including only those series that are listed in visibleSeriesKeys.static <S extends Comparable<S>>
RangefindRangeBounds(XYDataset<S> dataset)Returns the range of values in the range for the dataset.static <S extends Comparable<S>>
RangefindRangeBounds(XYDataset<S> dataset, boolean includeInterval)Returns the range of values in the range for the dataset.static <S extends Comparable<S>>
RangefindRangeBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)Finds the bounds of the y-values in the specified dataset, including only those series that are listed in visibleSeriesKeys, and those items whose x-values fall within the specified range.static <R extends Comparable<R>,C extends Comparable<C>>
RangefindStackedRangeBounds(CategoryDataset<R,C> dataset)Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.static <R extends Comparable<R>,C extends Comparable<C>>
RangefindStackedRangeBounds(CategoryDataset<R,C> dataset, double base)Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.static <R extends Comparable<R>,C extends Comparable<C>,G extends Comparable<G>>
RangefindStackedRangeBounds(CategoryDataset<R,C> dataset, KeyToGroupMap<R,G> map)Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.static <S extends Comparable<S>>
RangefindStackedRangeBounds(TableXYDataset<S> dataset)Returns the minimum and maximum values for the dataset's range, assuming that the series are stacked.static <S extends Comparable<S>>
RangefindStackedRangeBounds(TableXYDataset<S> dataset, double base)Returns the minimum and maximum values for the dataset's range, assuming that the series are stacked, using the specified base value.static <S extends Comparable<S>>
doublefindYValue(XYDataset<S> dataset, int series, double x)Returns the interpolated value of y that corresponds to the specified x-value in the given series.static <S extends Comparable<S>>
RangefindZBounds(XYZDataset<S> dataset)Returns the range of values in the z-dimension for the dataset.static <S extends Comparable<S>>
RangefindZBounds(XYZDataset<S> dataset, boolean includeInterval)Returns the range of values in the z-dimension for the dataset.static <S extends Comparable<S>>
RangefindZBounds(XYZDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)Finds the bounds of the z-values in the specified dataset, including only those series that are listed in visibleSeriesKeys, and those items whose x-values fall within the specified range.static booleanisEmptyOrNull(CategoryDataset<?,?> dataset)Returnstrueif the dataset is empty (ornull), andfalseotherwise.static booleanisEmptyOrNull(PieDataset<?> dataset)Returnstrueif the dataset is empty (ornull), andfalseotherwise.static <S extends Comparable<S>>
booleanisEmptyOrNull(XYDataset<S> dataset)Returnstrueif the dataset is empty (ornull), andfalseotherwise.static <S extends Comparable<S>>
RangeiterateDomainBounds(XYDataset<S> dataset)Iterates over the items in anXYDatasetto find the range of x-values.static <S extends Comparable<S>>
RangeiterateDomainBounds(XYDataset<S> dataset, boolean includeInterval)Iterates over the items in anXYDatasetto find the range of x-values.static <R extends Comparable<R>,C extends Comparable<C>>
RangeiterateRangeBounds(CategoryDataset<R,C> dataset)Iterates over the data item of the category dataset to find the range bounds.static <R extends Comparable<R>,C extends Comparable<C>>
RangeiterateRangeBounds(CategoryDataset<R,C> dataset, boolean includeInterval)Iterates over the data item of the category dataset to find the range bounds.static <S extends Comparable<S>>
RangeiterateRangeBounds(XYDataset<S> dataset)Iterates over the data item of the xy dataset to find the range bounds.static <S extends Comparable<S>>
RangeiterateRangeBounds(XYDataset<S> dataset, boolean includeInterval)Iterates over the data items of the xy dataset to find the range bounds.static <S extends Comparable<S>>
RangeiterateToFindDomainBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, boolean includeInterval)Returns the range of x-values in the specified dataset for the data items belonging to the visible series.static <R extends Comparable<R>,C extends Comparable<C>>
RangeiterateToFindRangeBounds(CategoryDataset<R,C> dataset, List<R> visibleSeriesKeys, boolean includeInterval)Iterates over the data item of the category dataset to find the range bounds.static <S extends Comparable<S>>
RangeiterateToFindRangeBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)Returns the range of y-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.static <S extends Comparable<S>>
RangeiterateToFindZBounds(XYZDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)Returns the range of z-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.static <S extends Comparable<S>>
RangeiterateZBounds(XYZDataset<S> dataset)Iterates over the data item of the xyz dataset to find the z-dimension bounds.static <S extends Comparable<S>>
RangeiterateZBounds(XYZDataset<S> dataset, boolean includeInterval)Iterates over the data items of the xyz dataset to find the z-dimension bounds.static <S extends Comparable<S>>
XYDataset<S>sampleFunction2D(Function2D f, double start, double end, int samples, S seriesKey)Creates anXYDatasetby sampling the specified function over a fixed range.static <S extends Comparable<S>>
XYSeries<S>sampleFunction2DToSeries(Function2D f, double start, double end, int samples, S seriesKey)Creates anXYSeriesby sampling the specified function over a fixed range.
-
-
-
Method Detail
-
calculatePieDatasetTotal
public static <K extends Comparable<K>> double calculatePieDatasetTotal(PieDataset<K> dataset)
Calculates the total of all the values in aPieDataset. If the dataset contains negative ornullvalues, they are ignored.- Type Parameters:
K- the type for the keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The total.
-
createPieDatasetForRow
public static <R extends Comparable<R>,C extends Comparable<C>> PieDataset<C> createPieDatasetForRow(CategoryDataset<R,C> dataset, R rowKey)
Creates a pie dataset from a table dataset by taking all the values for a single row.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).rowKey- the row key.- Returns:
- A pie dataset.
-
createPieDatasetForRow
public static <R extends Comparable<R>,C extends Comparable<C>> PieDataset<C> createPieDatasetForRow(CategoryDataset<R,C> dataset, int row)
Creates a pie dataset from a table dataset by taking all the values for a single row.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).row- the row (zero-based index).- Returns:
- A pie dataset.
-
createPieDatasetForColumn
public static <R extends Comparable<R>,C extends Comparable<C>> PieDataset<R> createPieDatasetForColumn(CategoryDataset<R,C> dataset, C columnKey)
Creates a pie dataset from a table dataset by taking all the values for a single column.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).columnKey- the column key.- Returns:
- A pie dataset.
-
createPieDatasetForColumn
public static <R extends Comparable<R>,C extends Comparable<C>> PieDataset<R> createPieDatasetForColumn(CategoryDataset<R,C> dataset, int column)
Creates a pie dataset from aCategoryDatasetby taking all the values for a single column.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).column- the column (zero-based index).- Returns:
- A pie dataset.
-
createConsolidatedPieDataset
public static <K extends Comparable<K>> PieDataset<K> createConsolidatedPieDataset(PieDataset<K> source, K key, double minimumPercent)
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 thepercentThreshold) into a single item with the key "Other".- Type Parameters:
K- the type for the data keys.- Parameters:
source- the source dataset (nullnot permitted).key- a new key for the aggregated items (nullnot permitted).minimumPercent- the percent threshold.- Returns:
- The pie dataset with (possibly) aggregated items.
-
createConsolidatedPieDataset
public static <K extends Comparable<K>> PieDataset<K> createConsolidatedPieDataset(PieDataset<K> source, K key, double minimumPercent, int minItems)
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 thepercentThreshold) into a single item. The aggregated items are assigned the specified key. Aggregation only occurs if there are at leastminItemsitems to aggregate.- Type Parameters:
K- the type for the data keys.- Parameters:
source- the source dataset (nullnot permitted).key- the key to represent the aggregated items.minimumPercent- the percent threshold (ten percent is 0.10).minItems- only aggregate low values if there are at least this many.- Returns:
- The pie dataset with (possibly) aggregated items.
-
createCategoryDataset
public static CategoryDataset<String,String> createCategoryDataset(String rowKeyPrefix, String columnKeyPrefix, double[][] data)
Creates aCategoryDatasetthat contains a copy of the data in an array (instances ofdoubleare created to represent the data items).Row and column keys are created by appending 0, 1, 2, ... to the supplied prefixes.
- Parameters:
rowKeyPrefix- the row key prefix.columnKeyPrefix- the column key prefix.data- the data.- Returns:
- The dataset.
-
createCategoryDataset
public static CategoryDataset<String,String> createCategoryDataset(String rowKeyPrefix, String columnKeyPrefix, Number[][] data)
Creates aCategoryDatasetthat contains a copy of the data in an array.Row and column keys are created by appending 0, 1, 2, ... to the supplied prefixes.
- Parameters:
rowKeyPrefix- the row key prefix.columnKeyPrefix- the column key prefix.data- the data.- Returns:
- The dataset.
-
createCategoryDataset
public static <R extends Comparable<R>,C extends Comparable<C>> CategoryDataset<R,C> createCategoryDataset(R[] rowKeys, C[] columnKeys, double[][] data)
Creates aCategoryDatasetthat contains a copy of the data in an array (instances ofdoubleare created to represent the data items).Row and column keys are taken from the supplied arrays.
- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
rowKeys- the row keys (nullnot permitted).columnKeys- the column keys (nullnot permitted).data- the data.- Returns:
- The dataset.
-
createCategoryDataset
public static <R extends Comparable<R>,C extends Comparable<C>> CategoryDataset<R,C> createCategoryDataset(R rowKey, KeyedValues<C> rowData)
Creates aCategoryDatasetby copying the data from the suppliedKeyedValuesinstance.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
rowKey- the row key (nullnot permitted).rowData- the row data (nullnot permitted).- Returns:
- A dataset.
-
sampleFunction2D
public static <S extends Comparable<S>> XYDataset<S> sampleFunction2D(Function2D f, double start, double end, int samples, S seriesKey)
Creates anXYDatasetby sampling the specified function over a fixed range.- Type Parameters:
S- the type for the series keys.- Parameters:
f- the function (nullnot permitted).start- the start value for the range.end- the end value for the range.samples- the number of sample points (must be > 1).seriesKey- the key to give the resulting series (nullnot permitted).- Returns:
- A dataset.
-
sampleFunction2DToSeries
public static <S extends Comparable<S>> XYSeries<S> sampleFunction2DToSeries(Function2D f, double start, double end, int samples, S seriesKey)
Creates anXYSeriesby sampling the specified function over a fixed range.- Type Parameters:
S- the type for the series keys.- Parameters:
f- the function (nullnot permitted).start- the start value for the range.end- the end value for the range.samples- the number of sample points (must be > 1).seriesKey- the key to give the resulting series (nullnot permitted).- Returns:
- A series.
- Since:
- 1.0.13
-
isEmptyOrNull
public static boolean isEmptyOrNull(PieDataset<?> dataset)
Returnstrueif the dataset is empty (ornull), andfalseotherwise.- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- A boolean.
-
isEmptyOrNull
public static boolean isEmptyOrNull(CategoryDataset<?,?> dataset)
Returnstrueif the dataset is empty (ornull), andfalseotherwise.- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- A boolean.
-
isEmptyOrNull
public static <S extends Comparable<S>> boolean isEmptyOrNull(XYDataset<S> dataset)
Returnstrueif the dataset is empty (ornull), andfalseotherwise.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- A boolean.
-
findDomainBounds
public static <S extends Comparable<S>> Range findDomainBounds(XYDataset<S> dataset)
Returns the range of values in the domain (x-values) of a dataset.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range of values (possibly
null).
-
findDomainBounds
public static <S extends Comparable<S>> Range findDomainBounds(XYDataset<S> dataset, boolean includeInterval)
Returns the range of values in the domain (x-values) of a dataset.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- determines whether or not the x-interval is taken into account (only applies if the dataset is anIntervalXYDataset).- Returns:
- The range of values (possibly
null).
-
findDomainBounds
public static <S extends Comparable<S>> Range findDomainBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, boolean includeInterval)
Returns the bounds of the x-values in the specifieddatasettaking into account only the visible series and including any x-interval if requested.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the visible series keys (nullnot permitted).includeInterval- include the x-interval (if any)?- Returns:
- The bounds (or
nullif the dataset contains no values). - Since:
- 1.0.13
-
iterateDomainBounds
public static <S extends Comparable<S>> Range iterateDomainBounds(XYDataset<S> dataset)
Iterates over the items in anXYDatasetto find the range of x-values. If the dataset is an instance ofIntervalXYDataset, the starting and ending x-values will be used for the bounds calculation.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
iterateDomainBounds
public static <S extends Comparable<S>> Range iterateDomainBounds(XYDataset<S> dataset, boolean includeInterval)
Iterates over the items in anXYDatasetto find the range of x-values.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines, for anIntervalXYDataset, whether the x-interval or just the x-value is used to determine the overall range.- Returns:
- The range (possibly
null).
-
findRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findRangeBounds(CategoryDataset<R,C> dataset)
Returns the range of values in the range for the dataset.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
findRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findRangeBounds(CategoryDataset<R,C> dataset, boolean includeInterval)
Returns the range of values in the range for the dataset.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The range (possibly
null).
-
findRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findRangeBounds(CategoryDataset<R,C> dataset, List<R> visibleSeriesKeys, boolean includeInterval)
Finds the bounds of the y-values in the specified dataset, including only those series that are listed in visibleSeriesKeys.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the keys for the visible series (nullnot permitted).includeInterval- include the y-interval (if the dataset has a y-interval).- Returns:
- The data bounds.
- Since:
- 1.0.13
-
findRangeBounds
public static <S extends Comparable<S>> Range findRangeBounds(XYDataset<S> dataset)
Returns the range of values in the range for the dataset. This method is the partner for thefindDomainBounds(XYDataset)method.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
findRangeBounds
public static <S extends Comparable<S>> Range findRangeBounds(XYDataset<S> dataset, boolean includeInterval)
Returns the range of values in the range for the dataset. This method is the partner for thefindDomainBounds(XYDataset, boolean)method.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The range (possibly
null).
-
findRangeBounds
public static <S extends Comparable<S>> Range findRangeBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)
Finds the bounds of the y-values in the specified dataset, including only those series that are listed in visibleSeriesKeys, and those items whose x-values fall within the specified range.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the keys for the visible series (nullnot permitted).xRange- the x-range (nullnot permitted).includeInterval- include the y-interval (if the dataset has a y-interval).- Returns:
- The data bounds.
- Since:
- 1.0.13
-
iterateRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range iterateRangeBounds(CategoryDataset<R,C> dataset)
Iterates over the data item of the category dataset to find the range bounds.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null). - Since:
- 1.0.10
-
iterateRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range iterateRangeBounds(CategoryDataset<R,C> dataset, boolean includeInterval)
Iterates over the data item of the category dataset to find the range bounds.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The range (possibly
null). - Since:
- 1.0.10
-
iterateToFindRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range iterateToFindRangeBounds(CategoryDataset<R,C> dataset, List<R> visibleSeriesKeys, boolean includeInterval)
Iterates over the data item of the category dataset to find the range bounds.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval is taken into account.visibleSeriesKeys- the visible series keys.- Returns:
- The range (possibly
null). - Since:
- 1.0.13
-
iterateRangeBounds
public static <S extends Comparable<S>> Range iterateRangeBounds(XYDataset<S> dataset)
Iterates over the data item of the xy dataset to find the range bounds.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null). - Since:
- 1.0.10
-
iterateRangeBounds
public static <S extends Comparable<S>> Range iterateRangeBounds(XYDataset<S> dataset, boolean includeInterval)
Iterates over the data items of the xy dataset to find the range bounds.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines, for anIntervalXYDataset, whether the y-interval or just the y-value is used to determine the overall range.- Returns:
- The range (possibly
null). - Since:
- 1.0.10
-
findZBounds
public static <S extends Comparable<S>> Range findZBounds(XYZDataset<S> dataset)
Returns the range of values in the z-dimension for the dataset. This method is the partner for thefindRangeBounds(XYDataset)andfindDomainBounds(XYDataset)methods.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
findZBounds
public static <S extends Comparable<S>> Range findZBounds(XYZDataset<S> dataset, boolean includeInterval)
Returns the range of values in the z-dimension for the dataset. This method is the partner for thefindRangeBounds(XYDataset, boolean)andfindDomainBounds(XYDataset, boolean)methods.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- a flag that determines whether or not the z-interval is taken into account.- Returns:
- The range (possibly
null).
-
findZBounds
public static <S extends Comparable<S>> Range findZBounds(XYZDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)
Finds the bounds of the z-values in the specified dataset, including only those series that are listed in visibleSeriesKeys, and those items whose x-values fall within the specified range.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the keys for the visible series (nullnot permitted).xRange- the x-range (nullnot permitted).includeInterval- include the z-interval (if the dataset has a z-interval).- Returns:
- The data bounds.
-
iterateZBounds
public static <S extends Comparable<S>> Range iterateZBounds(XYZDataset<S> dataset)
Iterates over the data item of the xyz dataset to find the z-dimension bounds.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (possibly
null).
-
iterateZBounds
public static <S extends Comparable<S>> Range iterateZBounds(XYZDataset<S> dataset, boolean includeInterval)
Iterates over the data items of the xyz dataset to find the z-dimension bounds.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).includeInterval- include the z-interval (if the dataset has a z-interval.- Returns:
- The range (possibly
null).
-
iterateToFindDomainBounds
public static <S extends Comparable<S>> Range iterateToFindDomainBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, boolean includeInterval)
Returns the range of x-values in the specified dataset for the data items belonging to the visible series.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the visible series keys (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval for the dataset is included (this only applies if the dataset is an instance of IntervalXYDataset).- Returns:
- The x-range (possibly
null). - Since:
- 1.0.13
-
iterateToFindRangeBounds
public static <S extends Comparable<S>> Range iterateToFindRangeBounds(XYDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)
Returns the range of y-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the visible series keys (nullnot permitted).xRange- the x-range (nullnot permitted).includeInterval- a flag that determines whether or not the y-interval for the dataset is included (this only applies if the dataset is an instance of IntervalXYDataset).- Returns:
- The y-range (possibly
null). - Since:
- 1.0.13
-
iterateToFindZBounds
public static <S extends Comparable<S>> Range iterateToFindZBounds(XYZDataset<S> dataset, List<S> visibleSeriesKeys, Range xRange, boolean includeInterval)
Returns the range of z-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).visibleSeriesKeys- the visible series keys (nullnot permitted).xRange- the x-range (nullnot permitted).includeInterval- a flag that determines whether or not the z-interval for the dataset is included (this only applies if the dataset has an interval, which is currently not supported).- Returns:
- The y-range (possibly
null).
-
findMinimumDomainValue
public static <S extends Comparable<S>> Number findMinimumDomainValue(XYDataset<S> dataset)
Finds the minimum domain (or X) value for the specified dataset. This is easy if the dataset implements theDomainInfointerface (a good idea if there is an efficient way to determine the minimum value). Otherwise, it involves iterating over the entire data-set.Returns
nullif all the data values in the dataset arenull.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The minimum value (possibly
null).
-
findMaximumDomainValue
public static <S extends Comparable<S>> Number findMaximumDomainValue(XYDataset<S> dataset)
Returns the maximum domain value for the specified dataset. This is easy if the dataset implements theDomainInfointerface (a good idea if there is an efficient way to determine the maximum value). Otherwise, it involves iterating over the entire data-set. Returnsnullif all the data values in the dataset arenull.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The maximum value (possibly
null).
-
findMinimumRangeValue
public static <R extends Comparable<R>,C extends Comparable<C>> Number findMinimumRangeValue(CategoryDataset<R,C> dataset)
Returns the minimum range value for the specified dataset. This is easy if the dataset implements theRangeInfointerface (a good idea if there is an efficient way to determine the minimum value). Otherwise, it involves iterating over the entire data-set. Returnsnullif all the data values in the dataset arenull.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The minimum value (possibly
null).
-
findMinimumRangeValue
public static <S extends Comparable<S>> Number findMinimumRangeValue(XYDataset<S> dataset)
Returns the minimum range value for the specified dataset. This is easy if the dataset implements theRangeInfointerface (a good idea if there is an efficient way to determine the minimum value). Otherwise, it involves iterating over the entire data-set. Returnsnullif all the data values in the dataset arenull.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The minimum value (possibly
null).
-
findMaximumRangeValue
public static <R extends Comparable<R>,C extends Comparable<C>> Number findMaximumRangeValue(CategoryDataset<R,C> dataset)
Returns the maximum range value for the specified dataset. This is easy if the dataset implements theRangeInfointerface (a good idea if there is an efficient way to determine the maximum value). Otherwise, it involves iterating over the entire data-set. Returnsnullif all the data values arenull.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The maximum value (possibly
null).
-
findMaximumRangeValue
public static <S extends Comparable<S>> Number findMaximumRangeValue(XYDataset<S> dataset)
Returns the maximum range value for the specified dataset. This is easy if the dataset implements theRangeInfointerface (a good idea if there is an efficient way to determine the maximum value). Otherwise, it involves iterating over the entire data-set. Returnsnullif all the data values arenull.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The maximum value (possibly
null).
-
findStackedRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findStackedRangeBounds(CategoryDataset<R,C> dataset)
Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range (
nullif the dataset contains no values).
-
findStackedRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findStackedRangeBounds(CategoryDataset<R,C> dataset, double base)
Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).base- the base value for the bars.- Returns:
- The range (
nullif the dataset contains no values).
-
findStackedRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>,G extends Comparable<G>> Range findStackedRangeBounds(CategoryDataset<R,C> dataset, KeyToGroupMap<R,G> map)
Returns the minimum and maximum values for the dataset's range (y-values), assuming that the series in one category are stacked.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.G- the type for the group keys.- Parameters:
dataset- the dataset.map- a structure that maps series to groups.- Returns:
- The value range (
nullif the dataset contains no values).
-
findMinimumStackedRangeValue
public static <R extends Comparable<R>,C extends Comparable<C>> Number findMinimumStackedRangeValue(CategoryDataset<R,C> dataset)
Returns the minimum value in the dataset range, assuming that values in each category are "stacked".- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The minimum value.
- See Also:
findMaximumStackedRangeValue(CategoryDataset)
-
findMaximumStackedRangeValue
public static <R extends Comparable<R>,C extends Comparable<C>> Number findMaximumStackedRangeValue(CategoryDataset<R,C> dataset)
Returns the maximum value in the dataset range, assuming that values in each category are "stacked".- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The maximum value (possibly
null). - See Also:
findMinimumStackedRangeValue(CategoryDataset)
-
findStackedRangeBounds
public static <S extends Comparable<S>> Range findStackedRangeBounds(TableXYDataset<S> dataset)
Returns the minimum and maximum values for the dataset's range, assuming that the series are stacked.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range ([0.0, 0.0] if the dataset contains no values).
-
findStackedRangeBounds
public static <S extends Comparable<S>> Range findStackedRangeBounds(TableXYDataset<S> dataset, double base)
Returns the minimum and maximum values for the dataset's range, assuming that the series are stacked, using the specified base value.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).base- the base value.- Returns:
- The range (
nullif the dataset contains no values).
-
calculateStackTotal
public static <S extends Comparable<S>> double calculateStackTotal(TableXYDataset<S> dataset, int item)
Calculates the total for the y-values in all series for a given item index.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset.item- the item index.- Returns:
- The total.
- Since:
- 1.0.5
-
findCumulativeRangeBounds
public static <R extends Comparable<R>,C extends Comparable<C>> Range findCumulativeRangeBounds(CategoryDataset<R,C> dataset)
Calculates the range of values for a dataset where each item is the running total of the items for the current series.- Type Parameters:
R- the type for the row keys.C- the type for the column keys.- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The range.
- See Also:
findRangeBounds(CategoryDataset)
-
findYValue
public static <S extends Comparable<S>> double findYValue(XYDataset<S> dataset, int series, double x)
Returns the interpolated value of y that corresponds to the specified x-value in the given series. If the x-value falls outside the range of x-values for the dataset, this method returnsDouble.NaN.- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).series- the series index.x- the x-value.- Returns:
- The y value.
- Since:
- 1.0.16
-
findItemIndicesForX
public static <S extends Comparable<S>> int[] findItemIndicesForX(XYDataset<S> dataset, int series, double x)
Finds the indices of the the items in the dataset that span the specified x-value. There are three cases for the return value:- there is an exact match for the x-value at index i
(returns
int[] {i, i}); - the x-value falls between two (adjacent) items at index i and i+1
(returns
int[] {i, i+1}); - the x-value falls outside the domain bounds, in which case the
method returns
int[] {-1, -1}.
- Type Parameters:
S- the type for the series keys.- Parameters:
dataset- the dataset (nullnot permitted).series- the series index.x- the x-value.- Returns:
- The indices of the two items that span the x-value.
- Since:
- 1.0.16
- See Also:
findYValue(org.jfree.data.xy.XYDataset, int, double)
- there is an exact match for the x-value at index i
(returns
-
-