Keel 2.1RC2

org.keel.services.chart
Interface ChartFactory

All Known Implementing Classes:
JfreeChartChartFactory

public interface ChartFactory

Interface (Role) for a Factory class that can generate a Chart. The resulting chart should be able to be stored in a file and the file name returned to the caller. This filename can then be passed to a UI in order to display the finished chart. Alternately, the chart can be returned as an encoded String, ready to pass on the client UI for rendering.

Author:
Michael Nash

Field Summary
static int AREA_CHART
           
static int AREA_XY_CHART
           
static int BAR_CHART
           
static int BAR_CHART_3D
           
static int BUBBLE_CHART
           
static int CANDLE_STICK_CHART
           
static int COMPASS_CHART
           
static int GANNT_CHART
           
static int HIGH_LOW_CHART
           
static int HISTOGRAM
           
static int LINE_CHART
           
static int LINE_XY_CHART
           
static int METER_CHART
           
static int PIE_CHART
          All possible chart types.
static int PIE_CHART_3D
           
static java.lang.String ROLE
           
static int SCATTER_PLOT_CHART
           
static int SIGNAL_CHART
           
static int STACKED_AREA_CHART
           
static int STACKED_BAR_CHART
           
static int STACKED_BAR_CHART_3D
           
static int TIME_SERIES_CHART
           
static int WIND_PLOT_CHART
           
static int XY_BAR_CHART
           
static int XY_STEP_CHART
           
 
Method Summary
 byte[] getChart(java.lang.String fileType, int width, int height)
           
 java.lang.String getChartEncoded(java.lang.String fileType, int width, int height)
          Prepare the chart and return it as a base64 encoded string, suitable for serialization via JMS (or anything else) to a client, saving in a database, etc.
 java.util.Set getSupportedChartTypes()
          Return a Set of integers, one for each of the support chart types for this implementation
 java.util.Set getSupportedFileTypes()
          Return a set of strings, where each string represents the file-type extension of a type of file supported by this implementation.
 java.util.Set getSupportedOptions()
          Once the chart type is set, getSupportedOptions can be called to determine what options (if any) this type of chart supports with this implementation.
 void saveChart(java.lang.String fileName, java.lang.String fileType, int width, int height)
          Produce the chart and save it as an image in the specified file.
 void setChartType(int chartType)
          Specify the type of chart to be produced.
 void setData(ChartData theData)
          Pass the data from which the chart is produced.
 void setOption(java.lang.String optionName, java.lang.Object option)
          Set a specific chart-type-specific or implementation-specific option.
 

Field Detail

ROLE

public static final java.lang.String ROLE
See Also:
Constant Field Values

PIE_CHART

public static final int PIE_CHART
All possible chart types. Not all implementations will support all types of chart, check the "getSupportedChartTypes" method.

See Also:
Constant Field Values

PIE_CHART_3D

public static final int PIE_CHART_3D
See Also:
Constant Field Values

AREA_CHART

public static final int AREA_CHART
See Also:
Constant Field Values

STACKED_AREA_CHART

public static final int STACKED_AREA_CHART
See Also:
Constant Field Values

BAR_CHART

public static final int BAR_CHART
See Also:
Constant Field Values

STACKED_BAR_CHART

public static final int STACKED_BAR_CHART
See Also:
Constant Field Values

BAR_CHART_3D

public static final int BAR_CHART_3D
See Also:
Constant Field Values

STACKED_BAR_CHART_3D

public static final int STACKED_BAR_CHART_3D
See Also:
Constant Field Values

LINE_CHART

public static final int LINE_CHART
See Also:
Constant Field Values

GANNT_CHART

public static final int GANNT_CHART
See Also:
Constant Field Values

LINE_XY_CHART

public static final int LINE_XY_CHART
See Also:
Constant Field Values

AREA_XY_CHART

public static final int AREA_XY_CHART
See Also:
Constant Field Values

SCATTER_PLOT_CHART

public static final int SCATTER_PLOT_CHART
See Also:
Constant Field Values

BUBBLE_CHART

public static final int BUBBLE_CHART
See Also:
Constant Field Values

WIND_PLOT_CHART

public static final int WIND_PLOT_CHART
See Also:
Constant Field Values

TIME_SERIES_CHART

public static final int TIME_SERIES_CHART
See Also:
Constant Field Values

XY_BAR_CHART

public static final int XY_BAR_CHART
See Also:
Constant Field Values

HIGH_LOW_CHART

public static final int HIGH_LOW_CHART
See Also:
Constant Field Values

CANDLE_STICK_CHART

public static final int CANDLE_STICK_CHART
See Also:
Constant Field Values

SIGNAL_CHART

public static final int SIGNAL_CHART
See Also:
Constant Field Values

XY_STEP_CHART

public static final int XY_STEP_CHART
See Also:
Constant Field Values

HISTOGRAM

public static final int HISTOGRAM
See Also:
Constant Field Values

METER_CHART

public static final int METER_CHART
See Also:
Constant Field Values

COMPASS_CHART

public static final int COMPASS_CHART
See Also:
Constant Field Values
Method Detail

getSupportedChartTypes

public java.util.Set getSupportedChartTypes()
Return a Set of integers, one for each of the support chart types for this implementation

Returns:
Set of supported chart types

getSupportedFileTypes

public java.util.Set getSupportedFileTypes()
Return a set of strings, where each string represents the file-type extension of a type of file supported by this implementation. A supported file-type must be specified when calling "saveChart"

Returns:

setChartType

public void setChartType(int chartType)
                  throws ChartException
Specify the type of chart to be produced. An implementation can throw an exception if an unsupported type is requested.

Parameters:
chartType -
Throws:
ChartException

getSupportedOptions

public java.util.Set getSupportedOptions()
Once the chart type is set, getSupportedOptions can be called to determine what options (if any) this type of chart supports with this implementation. setOption can then be called to specify the option values before saveChart is called. This method should be called after setChartType is called, as different types of charts support different options.

Returns:
A Set of strings, where each string is the name of an option recognized by this implementation and this type of chart.

setOption

public void setOption(java.lang.String optionName,
                      java.lang.Object option)
               throws ChartException
Set a specific chart-type-specific or implementation-specific option. An implementation should *not* throw an exception if an unsupported option is requested, the option should just be ignored.

Parameters:
optionName -
option -
Throws:
ChartException

setData

public void setData(ChartData theData)
             throws ChartException
Pass the data from which the chart is produced. Must be called before "saveChart" is called.

Parameters:
theData - A ChartData object containing the chart data to be plotted.
Throws:
ChartException

saveChart

public void saveChart(java.lang.String fileName,
                      java.lang.String fileType,
                      int width,
                      int height)
               throws ChartException
Produce the chart and save it as an image in the specified file.

Parameters:
fileName - Name of the file in which to save the chart
fileType - Valid file type (supported by this implementation)
width - Width of the image in pixels
height - Height of the image in pixels
Throws:
ChartException

getChart

public byte[] getChart(java.lang.String fileType,
                       int width,
                       int height)
                throws ChartException
Throws:
ChartException

getChartEncoded

public java.lang.String getChartEncoded(java.lang.String fileType,
                                        int width,
                                        int height)
                                 throws ChartException
Prepare the chart and return it as a base64 encoded string, suitable for serialization via JMS (or anything else) to a client, saving in a database, etc.

Parameters:
fileType -
width -
height -
Returns:
Throws:
ChartException

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.