|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.corpstein.image.ChartFactory
public class ChartFactory
Creates chart images and write them to files using common encodings.
ChartFactory relies on the helper classes ChartData
,
ChartStyle
, and ChartMetrics
to encapsulate all of the
parameters related to a chart. Since ChartFactory follows the Singleton
pattern, all constructors are private. To obtain a ChartFactory, use the
static getInstance
method.
Method Summary | |
---|---|
boolean |
canReadFormat(java.lang.String format)
Returns true if a there exists a registered ImageReader that
can decode the specified format |
boolean |
canWriteFormat(java.lang.String format)
Returns true if there exists a registered ImageWriter that
can encode the specified format |
java.awt.Image |
createBarChart(ChartData data)
Creates a bar chart based on the specified ChartData. |
java.awt.Image |
createBarChart(ChartData data,
ChartStyle style)
Creates a bar chart based on the specified ChartData and ChartStyle. |
java.awt.Image |
createBarChart(ChartData data,
ChartStyle style,
ChartMetrics metrics)
Creates a bar chart based on the specified ChartData, ChartStyle, and ChartMetrics. |
java.awt.Image |
createChart(ChartData data,
ChartStyle style)
Creates a chart based on the specified ChartData and ChartStyle. |
java.awt.Image |
createChart(ChartData data,
ChartStyle style,
ChartMetrics metrics)
Creates a chart based on the specified ChartData, ChartStyle, and ChartMetrics. |
java.awt.Image |
createLineChart(ChartData data)
Creates a line chart based on the specified ChartData |
java.awt.Image |
createLineChart(ChartData data,
ChartStyle style)
Creates a line chart based on the specified ChartData and ChartStyle |
java.awt.Image |
createLineChart(ChartData data,
ChartStyle style,
ChartMetrics metrics)
Creates a line chart based on the specified ChartData, ChartStyle, and ChartMetrics |
java.awt.Image |
createPieChart(ChartData data)
Creates a pie chart based on the specified ChartData and default ChartStyle and ChartMetrics |
java.awt.Image |
createPieChart(ChartData data,
ChartStyle style)
Creates a pie chart based on the specified ChartData and ChartStyle using default ChartMetrics |
java.awt.Image |
createPieChart(ChartData data,
ChartStyle style,
ChartMetrics metrics)
Creates a pie chart based on the specified ChartData, ChartStyle, and ChartMetrics |
static ChartFactory |
getInstance()
If a ChartFactory is not already allocated, create it. |
void |
writeImage(java.awt.Image image,
java.lang.String filename)
Writes the specified image to the file specified using the file extension to determine the image format |
void |
writeImage(java.awt.Image image,
java.lang.String format,
java.lang.String filename)
Writes the specified image to the file and format specified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean canReadFormat(java.lang.String format)
true
if a there exists a registered ImageReader
that
can decode the specified format
format
- String The image format to use (png, jpeg, tiff, etc.)
public boolean canWriteFormat(java.lang.String format)
true
if there exists a registered ImageWriter
that
can encode the specified format
format
- The image format to use (png, jpeg, tiff, etc.)
public java.awt.Image createBarChart(ChartData data)
data
- A ChartData object containing the chart title, labels and
values to be used
public java.awt.Image createBarChart(ChartData data, ChartStyle style)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be used
public java.awt.Image createBarChart(ChartData data, ChartStyle style, ChartMetrics metrics)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be usedmetrics
- A ChartMetrics object overriding the specific sizes,
distances, offsets, etc. to be used
public java.awt.Image createChart(ChartData data, ChartStyle style)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be used
public java.awt.Image createChart(ChartData data, ChartStyle style, ChartMetrics metrics)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be usedmetrics
- A ChartMetrics object overriding the specific sizes,
distances, offsets, etc. to be used
public java.awt.Image createLineChart(ChartData data)
data
- A ChartData object containing the chart title, labels and
values to be used
public java.awt.Image createLineChart(ChartData data, ChartStyle style)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be used
public java.awt.Image createLineChart(ChartData data, ChartStyle style, ChartMetrics metrics)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be usedmetrics
- A ChartMetrics object overriding the specific sizes,
distances, offsets, etc. to be used
public java.awt.Image createPieChart(ChartData data)
data
- A ChartData object containing the chart title, labels and
values to be used
public java.awt.Image createPieChart(ChartData data, ChartStyle style)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be used
public java.awt.Image createPieChart(ChartData data, ChartStyle style, ChartMetrics metrics)
data
- A ChartData object containing the chart title, labels and
values to be usedstyle
- A ChartStyle object containing the color and style
options to be usedmetrics
- A ChartMetrics object overriding the specific sizes,
distances, offsets, etc. to be used
public static ChartFactory getInstance()
public void writeImage(java.awt.Image image, java.lang.String filename) throws java.io.IOException
image
- The image to writefilename
- The filename to use
java.io.IOException
- if unable to write to the specified filepublic void writeImage(java.awt.Image image, java.lang.String format, java.lang.String filename) throws java.io.IOException
image
- java.awt.Image The image to writeformat
- String The image format to use (png, jpeg, tiff, etc.)filename
- String The filename to use
java.io.IOException
- if unable to write to the specified file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |