JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart.data
Class ChartDataSourceUtil

java.lang.Object
  |
  +--com.klg.jclass.chart.data.ChartDataSourceUtil

public class ChartDataSourceUtil
extends Object

ChartDataSourceUtil hosts a collection of useful data source related methods.


Constructor Summary
ChartDataSourceUtil()
           
 
Method Summary
static String buildDataSourceString(com.klg.jclass.chart.ChartDataModel src)
          Converts the provided data source into a string.
static String buildDataSourceString(com.klg.jclass.chart.ChartDataModel src, boolean doExpand)
          Converts the provided data source into a string.
static boolean checkPointLabels(String[] pointLabels)
          Check if there are any non-empty point labels.
protected static String doubleToString(double d, double hole, boolean doHoles)
          Convert this double to a string, optionally taking into account the hole value.
static String expandText(String s)
          Expand text string to escape unprintable characters with character entities.
static double[][] generateMultipleXSeries(double[][] y)
          Generates multiple series of x data using the supplied y data.
static double[][] generateSingleXSeries(int length)
          Generates a single series of x data given the supplied array length.
static int getHighCharacterBound()
          Get the high character bound.
static int getLowCharacterBound()
          Get the low character bound.
static String processText(String s)
          Remove all html character entities from the string and replace with the actual unicode character.
static void setCharacterBounds(int lower, int higher)
          Set the lower and upper character bounds as integers.
static void writeDataSource(com.klg.jclass.chart.ChartDataModel src, OutputStream os, boolean doExpand)
          Writes the provided data source to the given output stream.
static void writeDataSource(com.klg.jclass.chart.ChartDataModel src, OutputStreamWriter writer, boolean doExpand)
          Writes the provided data source using the given OutputStreamWriter.
static void writeDataSource(com.klg.jclass.chart.ChartDataModel src, String fileName, boolean doExpand)
          Writes the provided data source to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartDataSourceUtil

public ChartDataSourceUtil()
Method Detail

setCharacterBounds

public static void setCharacterBounds(int lower,
                                      int higher)
Set the lower and upper character bounds as integers. By default this range is set to be low=32 and high=126 which is the normal ascii printable range.

Parameters:
lower - The new lower bound
higher - The new higher bound

getLowCharacterBound

public static int getLowCharacterBound()
Get the low character bound.

Returns:
The current low character bound

getHighCharacterBound

public static int getHighCharacterBound()
Get the high character bound.

Returns:
The current high character bound

generateSingleXSeries

public static double[][] generateSingleXSeries(int length)
Generates a single series of x data given the supplied array length.

Parameters:
length - The length of the x series to generate
Returns:
A single X series of the given length in a doubly subscripted array

generateMultipleXSeries

public static double[][] generateMultipleXSeries(double[][] y)
Generates multiple series of x data using the supplied y data.

Parameters:
y - The y data
Returns:
A multilple series of x data that mirrors the inputted y data

doubleToString

protected static String doubleToString(double d,
                                       double hole,
                                       boolean doHoles)
Convert this double to a string, optionally taking into account the hole value. Use "max"/"min" to write out Double.MAX_VALUE/Double.MIN_VALUE.

Parameters:
d - The double to write out
hole - The hole value
doHoles - If true, write "hole" instead of the actual hole value
Returns:
The double as a string

buildDataSourceString

public static String buildDataSourceString(com.klg.jclass.chart.ChartDataModel src)
Converts the provided data source into a string. This string is compatible with the format used to read in data from streams (file, URL, applet).

Parameters:
src - The data source
Returns:
A string version of the data source

buildDataSourceString

public static String buildDataSourceString(com.klg.jclass.chart.ChartDataModel src,
                                           boolean doExpand)
Converts the provided data source into a string. This string is compatible with the format used to read in data from streams (file, URL, applet).

Parameters:
src - The data source
doExpand - Replace characters outside of the character bounds range with html character entities
Returns:
A string version of the data source
See Also:
setCharacterBounds(int, int)

checkPointLabels

public static boolean checkPointLabels(String[] pointLabels)
Check if there are any non-empty point labels.

Parameters:
pointLabels - The point label list to check
Returns:
true if there is at least one non-empty point label

writeDataSource

public static void writeDataSource(com.klg.jclass.chart.ChartDataModel src,
                                   String fileName,
                                   boolean doExpand)
                            throws IOException
Writes the provided data source to a file.

Parameters:
src - The data source
fileName - The file name to write to.
doExpand - Replace characters outside of the character bounds range with html character entities
Throws:
IOException
See Also:
setCharacterBounds(int, int)

writeDataSource

public static void writeDataSource(com.klg.jclass.chart.ChartDataModel src,
                                   OutputStream os,
                                   boolean doExpand)
                            throws IOException
Writes the provided data source to the given output stream.

Parameters:
src - The data source
os - The output stream to write to.
doExpand - Replace characters outside of the character bounds range with html character entities
Throws:
IOException
See Also:
setCharacterBounds(int, int)

writeDataSource

public static void writeDataSource(com.klg.jclass.chart.ChartDataModel src,
                                   OutputStreamWriter writer,
                                   boolean doExpand)
                            throws IOException
Writes the provided data source using the given OutputStreamWriter.

Parameters:
src - The data source
writer - The OutputStreamWriter with which to write
doExpand - Replace characters outside of the character bounds range with html character entities
Throws:
IOException
See Also:
setCharacterBounds(int, int)

expandText

public static String expandText(String s)
Expand text string to escape unprintable characters with character entities.

Parameters:
s - The string to expand
Returns:
The expanded string

processText

public static String processText(String s)
Remove all html character entities from the string and replace with the actual unicode character.

Parameters:
s - The input string
Returns:
The processed string

Copyright © 2004 Quest Software Inc..
All rights reserved.