|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.odesys.chart.image.ChartImage
ChartImage is the abstract superclass of the chart image generation components.
They are intended to be used on a web server to generate dynamic chart images.
ChartImage only handles the creation of the image, so it has to be placed in a
Servlet or JSP page that specifies the parameters and provides the OutputStream
that the image data is written into. In general the Servet will do the following:
1. Create a ChartImage instance.
2. Create appropriate ChartModel or use the default one and set its data.
3. Invoke write() with an appropriate OutputStream (most likely a ByteArrayOutputStream
that will be used as a buffer).
4. Set the content type of the Response to "image/jpeg", set the content length.
5. Write the data to the OutputStream of the Response.
ChartImage is not Thread-safe and may produce unexpected results if used by
multiple threads. ChartImage uses the package com.sun.image.codec.jpeg, which is
not part of the Java 2 Platform. It is provided with Sun's Java 2 SDK and
therefore ChartImage requres Sun's Java 2 Runtime Environment.
Constructor Summary | |
ChartImage()
Creates new ChartImage instance. |
Method Summary | |
protected abstract Chart |
createChart()
Factory methods that creates the Chart instance to be used by this ChartImage. |
protected Chart |
getChart()
Gets the Chart instance used by this ChartImage. |
ChartModel |
getModel()
Gets the ChartModel used by this ChartImage. |
void |
setBackground(java.awt.Color color)
Sets the background color of this ChartImage. |
void |
setChartBackground(java.awt.Color color)
Sets the background color of the internal ChartView. |
void |
setChartContoursVisible(boolean visible)
Detemines whether the contours of the Chart elements should be drawn. |
void |
setChartFont(java.awt.Font font)
Sets the font of the internal ChartView. |
void |
setChartForeground(java.awt.Color color)
Sets the foreground color of the internal ChartView. |
void |
setFont(java.awt.Font font)
Sets the Font of this ChartImage. |
void |
setLabelsVisible(boolean visible)
Sets whether the labels of this ChartImage elements are drawn. |
void |
setLegendBackground(java.awt.Color color)
Sets the background color of the internal LegendView. |
void |
setLegendContoursVisible(boolean visible)
Detemines whether the contours of the Legend items should be drawn. |
void |
setLegendFont(java.awt.Font font)
Sets the font of the internal LegendView. |
void |
setLegendForeground(java.awt.Color color)
Sets the foreground color of the internal LegendView. |
void |
setLegendVisible(boolean visible)
Shows or hides the Legend depending on the value of parameter visible. |
void |
setModel(ChartModel model)
Sets the ChartModel to be used by this ChartImage. |
void |
setQuality(float quality)
Sets the quality of the produced JPEG. |
void |
setSize(int width,
int height)
Sets the size of the image to be produced. |
void |
write(java.io.OutputStream out)
Writes the ChartImage JPEG data into the provided OutputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChartImage()
Method Detail |
protected abstract Chart createChart()
protected Chart getChart()
public void write(java.io.OutputStream out) throws java.io.IOException
out
- The OutputStream to write the JPEG data into.public void setQuality(float quality)
quality
- The quality of the produced JPEG [0.0f, 1.0f].public ChartModel getModel()
public void setModel(ChartModel model) throws java.lang.IllegalArgumentException
model
- The ChartModel to be used by this ChartImage.public void setSize(int width, int height)
width
- The width of the image.height
- The height of the image.public void setBackground(java.awt.Color color)
color
- The background color of this ChartImage.public void setFont(java.awt.Font font)
font
- The Font of this ChartImage.public void setLegendVisible(boolean visible)
visible
- If true, shows the Legend; otherwise, hides the Legend.public void setLabelsVisible(boolean visible)
public void setChartContoursVisible(boolean visible)
public void setLegendContoursVisible(boolean visible)
public void setChartBackground(java.awt.Color color)
color
- The background color of the internal ChartView.public void setChartForeground(java.awt.Color color)
color
- The foreground color of the internal ChartView.public void setChartFont(java.awt.Font font)
font
- The font of the internal ChartView.public void setLegendBackground(java.awt.Color color)
color
- The background color of the internal LegendView.public void setLegendForeground(java.awt.Color color)
color
- The foreground color of the internal LegendView.public void setLegendFont(java.awt.Font font)
font
- The font of the internal LegendView.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |