org.jfree.data

Class DataUtilities

public abstract class DataUtilities extends Object

Utility methods for use with some of the data classes (but not the datasets, see DatasetUtilities).
Method Summary
static doublecalculateColumnTotal(Values2D data, int column)
Returns the total of the values in one column of the supplied data table.
static doublecalculateRowTotal(Values2D data, int row)
Returns the total of the values in one row of the supplied data table.
static Number[]createNumberArray(double[] data)
Constructs an array of Number objects from an array of double primitives.
static Number[][]createNumberArray2D(double[][] data)
Constructs an array of arrays of Number objects from a corresponding structure containing double primitives.
static KeyedValuesgetCumulativePercentages(KeyedValues data)
Returns a KeyedValues instance that contains the cumulative percentage values for the data in another KeyedValues instance.

Method Detail

calculateColumnTotal

public static double calculateColumnTotal(Values2D data, int column)
Returns the total of the values in one column of the supplied data table.

Parameters: data the table of values (null not permitted). column the column index (zero-based).

Returns: The total of the values in the specified column.

calculateRowTotal

public static double calculateRowTotal(Values2D data, int row)
Returns the total of the values in one row of the supplied data table.

Parameters: data the table of values (null not permitted). row the row index (zero-based).

Returns: The total of the values in the specified row.

createNumberArray

public static Number[] createNumberArray(double[] data)
Constructs an array of Number objects from an array of double primitives.

Parameters: data the data (null not permitted).

Returns: An array of Double.

createNumberArray2D

public static Number[][] createNumberArray2D(double[][] data)
Constructs an array of arrays of Number objects from a corresponding structure containing double primitives.

Parameters: data the data (null not permitted).

Returns: An array of Double.

getCumulativePercentages

public static KeyedValues getCumulativePercentages(KeyedValues data)
Returns a KeyedValues instance that contains the cumulative percentage values for the data in another KeyedValues instance.

The percentages are values between 0.0 and 1.0 (where 1.0 = 100%).

Parameters: data the data (null not permitted).

Returns: The cumulative percentages.