org.jfree.eastwood
Class DataUtilities

java.lang.Object
  extended by org.jfree.eastwood.DataUtilities

public class DataUtilities
extends java.lang.Object

A utility class for reading data that uses the Google chart encoding.


Constructor Summary
DataUtilities()
           
 
Method Summary
static org.jfree.data.category.DefaultCategoryDataset parseCategoryDataset(java.lang.String dataStr, java.lang.String scalingStr)
          Parses a category dataset for use in bar charts.
static float[] parseDataScaling(java.lang.String scalingStr)
          Parses a data scaling string.
static java.util.List parseExtendedData(java.lang.String s)
          Parses a string that uses the "extended" data encoding from the Google Chart API.
static org.jfree.data.general.PieDataset parsePieDataset(java.lang.String dataStr, java.lang.String scalingStr)
          Parses a dataset from the incoming string (which may be encoded using the 'simple', 'extended' or 'text' encodings from the Google Chart API).
static org.jfree.data.xy.XYSeriesCollection parseScatterDataset(java.lang.String dataStr, java.lang.String scalingStr)
          Parses a dataset from the incoming string.
static java.util.List parseSimpleData(java.lang.String s)
          Parses a string that uses the "simple" data encoding from the Google Chart API.
static java.util.List parseTextData(java.lang.String dataStr, float[] scaling)
          Parses a string with text data encoding.
static org.jfree.data.xy.XYDataset parseXYDataset(java.lang.String dataStr, java.lang.String scalingStr)
          Parses a dataset from the incoming string.
static org.jfree.data.xy.XYDataset parseXYDataset2(java.lang.String dataStr, java.lang.String scalingStr)
          Parses a dataset from the incoming string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataUtilities

public DataUtilities()
Method Detail

parseSimpleData

public static java.util.List parseSimpleData(java.lang.String s)
Parses a string that uses the "simple" data encoding from the Google Chart API. The method returns a list of lists, with the sublists each containing the data values for one series, the values being represented by Double objects in the range 0.0 to 1.0. Missing values (which are encoded as '_') are returned as null entries in the list.

Parameters:
s - the data string (null not permitted).
Returns:
A list of sublists.

parseExtendedData

public static java.util.List parseExtendedData(java.lang.String s)
Parses a string that uses the "extended" data encoding from the Google Chart API. The method returns a list of lists, with the sublists each containing the data values for one series, the values being represented by Double objects in the range 0.0 to 1.0. Missing values (which are encoded as '__') are returned as null entries in the list.

Parameters:
s - the data string (null not permitted).
Returns:
A list of sublists.

parseTextData

public static java.util.List parseTextData(java.lang.String dataStr,
                                           float[] scaling)
Parses a string with text data encoding. The method returns a list of lists, with the sublists each containing the data values for one series, the values being represented by Float objects in the range 0.0 to 1.0. Missing values (which are encoded as any values outside the range 0.0 to 100.0) are returned as null entries in the list.

Parameters:
dataStr - the data string.
scaling - the scaling parameters.
Returns:
A list containing a sublist of Float objects for each series.

parseDataScaling

public static float[] parseDataScaling(java.lang.String scalingStr)
Parses a data scaling string. The returned array will always have a size multiple of 2. If the passed in string is null or empty this method returns {0, 100}. The values at odd positions are minimum values while the values at even positions are the max values.

Parameters:
scalingStr - the scaling string.
Returns:
the array of scaling values.

parsePieDataset

public static org.jfree.data.general.PieDataset parsePieDataset(java.lang.String dataStr,
                                                                java.lang.String scalingStr)
Parses a dataset from the incoming string (which may be encoded using the 'simple', 'extended' or 'text' encodings from the Google Chart API).

Parameters:
dataStr - the data string (null not permitted).
scalingStr - the scaling.
Returns:
A pie dataset.

parseCategoryDataset

public static org.jfree.data.category.DefaultCategoryDataset parseCategoryDataset(java.lang.String dataStr,
                                                                                  java.lang.String scalingStr)
Parses a category dataset for use in bar charts.

Parameters:
dataStr - the data string (null not permitted).
scalingStr - the scaling string.
Returns:
A category dataset.

parseXYDataset

public static org.jfree.data.xy.XYDataset parseXYDataset(java.lang.String dataStr,
                                                         java.lang.String scalingStr)
Parses a dataset from the incoming string. The data encoding only specifies the y-values.

Parameters:
dataStr - the data string (null not permitted).
scalingStr - the scaling string.
Returns:
A dataset.

parseXYDataset2

public static org.jfree.data.xy.XYDataset parseXYDataset2(java.lang.String dataStr,
                                                          java.lang.String scalingStr)
Parses a dataset from the incoming string. The data encoding specifies both the x-values and the y-values, in consecutive series.

Parameters:
dataStr - the data string (null not permitted).
scalingStr - the scaling string.
Returns:
A dataset.

parseScatterDataset

public static org.jfree.data.xy.XYSeriesCollection parseScatterDataset(java.lang.String dataStr,
                                                                       java.lang.String scalingStr)
Parses a dataset from the incoming string. The data encoding specifies both the x-values and the y-values, in consecutive series, with an optional third series supplying the relative marker sizes.

Parameters:
dataStr - the data string.
scalingStr - the scaling string.
Returns:
A dataset.


Copyright © 2010. All Rights Reserved.