|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ijchart.xychart.client.IJChart
public class IJChart
Title: IJChart
Description: a chart library for the Java(tm) platform.
This class used to draw charts.Copyright: Copyright (c) 2013
Company:
Field Summary | |
---|---|
static float |
DEFAULT_BACKGROUND_ALPHA
The default foreground alpha transparency. |
static java.awt.Image |
DEFAULT_BACKGROUND_IMAGE
The default background image. |
static Align |
DEFAULT_BACKGROUND_IMAGE_ALIGNMENT
The default background image alignment. |
static float |
DEFAULT_BACKGROUND_IMAGE_ALPHA
The default background image alpha. |
static java.awt.Paint |
DEFAULT_BACKGROUND_PAINT
The default background color. |
static boolean |
DEFAULT_BORDER_VISIBLE
A default flag that controls whether or not the chart border is drawn. |
static GradientPaintTransformType |
DEFAULT_GRADIENT_PAINT_TRANSFORM_TYPE
The defeault GradientPaint transform type. |
static boolean |
DEFAULT_NOTIFY
A default flag that can be used to enable/disable notification of chart change events. |
static java.awt.Font |
DEFAULT_TITLE_FONT
The default font for titles. |
Constructor Summary | |
---|---|
IJChart(AbstractPlot plot)
Creates a new chart based on the supplied plot. |
|
IJChart(java.lang.String title,
AbstractPlot plot)
Creates a new chart with the given title and plot. |
|
IJChart(java.lang.String title,
java.awt.Font titleFont,
AbstractPlot plot,
boolean createLegend)
Creates a new chart with the given title and plot. |
Method Summary | |
---|---|
void |
addChangeListener(IChartChangeListener listener)
Registers an object for notification of changes to the chart. |
void |
addProgressListener(IChartProgressListener listener)
Registers an object for notification of progress events relating to the chart. |
void |
addSubtitle(int index,
ITitle subtitle)
Adds a subtitle at a particular position in the subtitle list, and sends a ChartChangeEvent to all registered listeners. |
void |
addSubtitle(ITitle subtitle)
Adds a chart subtitle, and notifies registered listeners that the chart has been modified. |
void |
clearSubtitles()
Clears all subtitles from the chart and sends a ChartChangeEvent
to all registered listeners. |
java.lang.Object |
clone()
Clones the object, and takes care of listeners. |
java.awt.image.BufferedImage |
createBufferedImage(int imageWidth,
int imageHeight)
Creates and returns a buffered image into which the chart has been drawn. |
java.awt.image.BufferedImage |
createBufferedImage(int imageWidth,
int imageHeight,
double drawWidth,
double drawHeight)
Creates and returns a buffered image into which the chart has been drawn. |
java.awt.image.BufferedImage |
createBufferedImage(int imageWidth,
int imageHeight,
double drawWidth,
double drawHeight,
int imageType)
Creates and returns a buffered image into which the chart has been drawn. |
java.awt.image.BufferedImage |
createBufferedImage(int imageWidth,
int imageHeight,
int imageType)
Creates and returns a buffered image into which the chart has been drawn. |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D chartArea)
Draws the chart on a Java 2D graphics device (such as the screen or a printer). |
protected void |
drawBackground(java.awt.geom.Rectangle2D chartArea)
Fills the specified area with the background paint. |
protected void |
drawBackgroundImage(java.awt.geom.Rectangle2D chartArea)
Draws the background image (if there is one) aligned within the specified area. |
protected void |
drawBorder(java.awt.geom.Rectangle2D chartArea)
Draws the chart border. |
boolean |
drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
Draws the crosshair on a Java 2D graphics device (such as the screen or a printer). |
protected void |
drawLengend(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D chartArea)
Draws the legend on a Java 2D graphics device (such as the screen or a printer). |
protected void |
drawTitles(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D chartArea)
Draws the titles on a Java 2D graphics device (such as the screen or a printer). |
boolean |
equals(java.lang.Object obj)
Tests this chart for equality with another object. |
void |
fireChartChanged()
Sends a default ChartChangeEvent to all registered listeners. |
float |
getBackgroundAlpha()
Returns the alpha transparency of the plot area background. |
java.awt.Image |
getBackgroundImage()
Returns the background image for the chart. |
Align |
getBackgroundImageAlignment()
Returns the background image alignment. |
float |
getBackgroundImageAlpha()
Returns the alpha-transparency for the chart's background image. |
java.awt.Paint |
getBackgroundPaint()
Returns the paint used to draw the background of the chart. |
java.awt.Paint |
getBorderPaint()
Returns the paint used to draw the chart border (if visible). |
java.awt.Stroke |
getBorderStroke()
Returns the stroke used to draw the chart border (if visible). |
IChangeChartShape |
getChangeChartShape()
Returns the shape change object. |
ChartShapeCollection |
getChartShapes()
Returns the collection of chart shapes. |
GradientPaintTransformType |
getGradientPaintTransformType()
Get the ChartShape GradientPaintTransformType type. |
LegendTitle |
getLegendTitle()
Returns the chart legend title. |
RectangleInsets |
getPadding()
Returns the padding between the chart border and the chart drawing area. |
AbstractPlot |
getPlot()
Returns the plot for the chart. |
ITitle |
getSubtitle(int index)
Returns a chart subtitle. |
int |
getSubtitleCount()
Returns the number of titles for the chart. |
java.util.Collection |
getSubtitles()
Returns the list of subtitles for the chart,and this collection is unmodifiable. |
ITitle |
getTitle()
Returns the main chart title. |
int |
hashCode()
Returns a hash code for this object. |
boolean |
isBorderVisible()
Returns a flag that controls whether or not a border is drawn around the outside of the chart. |
boolean |
isNotify()
Returns a flag that controls whether or not change events are sent to registered listeners. |
boolean |
isShowLegend()
Returns whether or not the legend is visible. |
protected void |
notifyListeners(ChartChangeEvent event)
Sends a ChartChangeEvent to all registered listeners. |
void |
notifyListeners(ChartProgressEvent event)
Sends a ChartProgressEvent to all registered listeners. |
void |
plotChanged(PlotChangeEvent event)
Receives notification of a plot change event. |
void |
removeAllProgressListener()
Deregisters all object for notification of progress changes. |
void |
removeAllSubTitle()
Removes all subtitle and sends a ChartChangeEvent to
all registered listeners. |
void |
removeChangeListener(IChartChangeListener listener)
Deregisters an object for notification of changes to the chart. |
void |
removeProgressListener(IChartProgressListener listener)
Deregisters an object for notification of changes to the chart. |
void |
removeSubTitle(ITitle title)
Removes the specified subtitle and sends a ChartChangeEvent to
all registered listeners. |
void |
saveChartAsJPEG(java.io.File imageFile,
int width,
int height)
Save chart to JPEG image. |
void |
saveChartAsJPEG(java.io.OutputStream stream,
int width,
int height)
Save chart to JPEG image. |
void |
saveChartAsJPEG(java.lang.String filePath,
int width,
int height)
Save chart to JPEG image. |
void |
saveChartAsPNG(java.io.File imageFile,
int width,
int height)
Save chart to PNG image. |
void |
saveChartAsPNG(java.io.OutputStream stream,
int width,
int height)
Save chart to PNG image. |
void |
saveChartAsPNG(java.lang.String filePath,
int width,
int height)
Save chart to PNG image. |
void |
setBackgroundAlpha(float alpha)
Sets the alpha transparency of the plot area background, and notifies registered listeners that the plot has been modified. |
void |
setBackgroundImage(java.awt.Image image)
Sets the background image for the chart and sends a ChartChangeEvent to all registered listeners. |
void |
setBackgroundImageAlignment(Align alignment)
Sets the background alignment. |
void |
setBackgroundImageAlpha(float alpha)
Sets the alpha-transparency for the chart's background image. |
void |
setBackgroundPaint(java.awt.Paint paint)
Sets the paint used to fill the chart background and sends a ChartChangeEvent to all registered listeners. |
void |
setBorderPaint(java.awt.Paint paint)
Sets the paint used to draw the chart border (if visible),and sends a ChartChangeEvent to all registered listeners. |
void |
setBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the chart border (if visible),and sends a ChartChangeEvent to all registered listeners. |
void |
setBorderVisible(boolean visible)
Sets a flag that controls whether or not a border is drawn around the outside of the chart,and sends a ChartChangeEvent to all registered listeners. |
void |
setChangeChartShape(IChangeChartShape change)
Sets the shape change object,and notifies registered listeners that the plot has been modified. |
void |
setGradientPaintTransformType(GradientPaintTransformType transformType)
Sets the ChartShape GradientPaintTransformType type,use only when fill Paint is GradientPaint,and sends a ChartShapeChangeEvent
to all registered listeners. |
void |
setLegendTitle(LegendTitle legend)
Sets the chart legend title, and notifies registered listeners that the chart has been modified. |
void |
setNotify(boolean notify)
Sets a flag that controls whether or not listeners receive ChartChangeEvent notifications. |
void |
setPadding(RectangleInsets padding)
Sets the padding between the chart border and the chart drawing area, and sends a ChartChangeEvent to all registered listeners. |
void |
setShowLegend(boolean flag)
Sets whether or not the legend is visible,and sends a ChartChangeEvent to all registered listeners. |
void |
setTitle(ITitle title)
Sets the main title for the chart and sends a ChartChangeEvent
to all registered listeners. |
void |
setTitle(java.lang.String text)
Sets the chart title and sends a ChartChangeEvent to all
registered listeners. |
void |
titleChanged(TitleChangeEvent event)
Receives notification of a chart title change event. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.Font DEFAULT_TITLE_FONT
public static final java.awt.Paint DEFAULT_BACKGROUND_PAINT
public static final GradientPaintTransformType DEFAULT_GRADIENT_PAINT_TRANSFORM_TYPE
public static final java.awt.Image DEFAULT_BACKGROUND_IMAGE
public static final Align DEFAULT_BACKGROUND_IMAGE_ALIGNMENT
public static final float DEFAULT_BACKGROUND_IMAGE_ALPHA
public static final boolean DEFAULT_NOTIFY
public static final boolean DEFAULT_BORDER_VISIBLE
public static final float DEFAULT_BACKGROUND_ALPHA
Constructor Detail |
---|
public IJChart(AbstractPlot plot)
plot
- AbstractPlot
The plot (null not permitted).public IJChart(java.lang.String title, AbstractPlot plot)
title
- String
The chart title (null permitted).plot
- AbstractPlot
The plot (null not permitted).public IJChart(java.lang.String title, java.awt.Font titleFont, AbstractPlot plot, boolean createLegend)
title
- String
The chart title (null permitted).titleFont
- Font
The font for displaying the chart title (null permitted).plot
- AbstractPlot
The plot (null not permitted).createLegend
-
A flag indicating whether or not a legend should be created for the chart.Method Detail |
---|
public boolean isBorderVisible()
public void setBorderVisible(boolean visible)
ChartChangeEvent
to all registered listeners.
visible
- boolean
A boolean.public java.awt.Stroke getBorderStroke()
public void setBorderStroke(java.awt.Stroke stroke)
ChartChangeEvent
to all registered listeners.
stroke
- Stroke
The stroke (null not permitted).public java.awt.Paint getBorderPaint()
public void setBorderPaint(java.awt.Paint paint)
ChartChangeEvent
to all registered listeners.
paint
- Paint
The paint (null not permitted).public RectangleInsets getPadding()
public void setPadding(RectangleInsets padding)
ChartChangeEvent
to all registered listeners.
padding
- RectangleInsets
The padding (null not permitted).public ITitle getTitle()
addSubtitle(ITitle)
method.
public void setTitle(ITitle title)
ChartChangeEvent
to all registered listeners. If you do not want a title for the
chart, set it to null. If you want more than one title on
a chart, use the addSubtitle(ITitle)
method.
title
- ITitle
The title (null permitted).public void setTitle(java.lang.String text)
ChartChangeEvent
to all
registered listeners. This is a convenience method that ends up calling
the setTitle(ITitle)
method. If there is an existing title,
its text is updated, otherwise a new title using the default font is
added to the chart. If text is null the chart title is set to null.
text
-
The title text (null permitted).public void addSubtitle(ITitle subtitle)
subtitle
- ITitle
The subtitle (null not permitted).public ITitle getSubtitle(int index)
index
- int
The index of the chart subtitle (zero based).
public void addSubtitle(int index, ITitle subtitle)
ChartChangeEvent
to all registered listeners.
index
- int
The index (in the range 0 to getSubtitleCount()
).subtitle
- ITitle
The subtitle to add (null not permitted).public void clearSubtitles()
ChartChangeEvent
to all registered listeners.
public void removeSubTitle(ITitle title)
ChartChangeEvent
to
all registered listeners.
title
- ITitle
The subtitle.public void removeAllSubTitle()
ChartChangeEvent
to
all registered listeners.
public java.util.Collection getSubtitles()
public int getSubtitleCount()
public LegendTitle getLegendTitle()
public void setLegendTitle(LegendTitle legend)
legend
- LegendTitle
The legend title (null not permitted).public boolean isShowLegend()
public void setShowLegend(boolean flag)
ChartChangeEvent
to all registered listeners.
flag
- boolean
A boolean.public AbstractPlot getPlot()
public java.awt.Paint getBackgroundPaint()
public void setBackgroundPaint(java.awt.Paint paint)
ChartChangeEvent
to all registered listeners.
paint
- Paint
The paint (possibly null).public GradientPaintTransformType getGradientPaintTransformType()
public void setGradientPaintTransformType(GradientPaintTransformType transformType)
ChartShapeChangeEvent
to all registered listeners.
transformType
- GradientPaintTransformType
The gradient paint transform type (null permitted).public float getBackgroundAlpha()
public void setBackgroundAlpha(float alpha)
alpha
-
The new alpha value (in the range 0.0f to 1.0f).public java.awt.Image getBackgroundImage()
public void setBackgroundImage(java.awt.Image image)
ChartChangeEvent
to all registered listeners.
image
- Image
The image (null permitted).public Align getBackgroundImageAlignment()
Align
class.
public void setBackgroundImageAlignment(Align alignment)
Align
class.
alignment
- Align
The alignment.public float getBackgroundImageAlpha()
public void setBackgroundImageAlpha(float alpha)
alpha
- float
The alpha-transparency for background image,must between 0.0 and 1.0 .public boolean isNotify()
public void setNotify(boolean notify)
ChartChangeEvent
notifications.
notify
- boolean
A boolean.public ChartShapeCollection getChartShapes()
public IChangeChartShape getChangeChartShape()
public void setChangeChartShape(IChangeChartShape change)
change
- IChangeChartShape
The shape change object.public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D chartArea)
g2
- Graphics2D
The graphics device (null not permitted).chartArea
- Rectangle2D
The area within which the data should be drawn (null not permitted).public boolean drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
mouseClickPoint
- Point2D
The mouse click point (null permitted).
protected void drawBackground(java.awt.geom.Rectangle2D chartArea)
chartArea
-
The background draw area (null not permitted).protected void drawBackgroundImage(java.awt.geom.Rectangle2D chartArea)
chartArea
-
The background draw area (null not permitted).protected void drawBorder(java.awt.geom.Rectangle2D chartArea)
chartArea
-
The background draw area (null not permitted).protected void drawTitles(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D chartArea)
g2
- Graphics2D
The graphics device (null not permitted).chartArea
- Rectangle2D
The area within which the data should be drawn (null not permitted).protected void drawLengend(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D chartArea)
g2
- Graphics2D
The graphics device (null not permitted).chartArea
- Rectangle2D
The area within which the data should be drawn (null not permitted).public java.awt.image.BufferedImage createBufferedImage(int imageWidth, int imageHeight)
imageWidth
- int
The image width.imageHeight
- int
The image height.
public java.awt.image.BufferedImage createBufferedImage(int imageWidth, int imageHeight, int imageType)
imageWidth
- int
The image width.imageHeight
- int
The image height.imageType
- int
The image type.
public java.awt.image.BufferedImage createBufferedImage(int imageWidth, int imageHeight, double drawWidth, double drawHeight)
imageWidth
- int
The image width.imageHeight
- int
The image height.drawWidth
- int
The width for drawing the chart (will be scaled to fit image).drawHeight
- int
The height for drawing the chart (will be scaled to fit image).
public java.awt.image.BufferedImage createBufferedImage(int imageWidth, int imageHeight, double drawWidth, double drawHeight, int imageType)
imageWidth
- int
The image width.imageHeight
- int
The image height.drawWidth
- int
The width for drawing the chart (will be scaled to fit image).drawHeight
- int
The height for drawing the chart (will be scaled to fit image).imageType
- int
The image type.
public void addChangeListener(IChartChangeListener listener)
listener
- IChartChangeListener
The listener (null not permitted).public void removeChangeListener(IChartChangeListener listener)
listener
- IChartChangeListener
The listener (null not permitted).public void fireChartChanged()
ChartChangeEvent
to all registered listeners.
protected void notifyListeners(ChartChangeEvent event)
ChartChangeEvent
to all registered listeners.
event
- ChartChangeEvent
Information about the event that triggered the notification.public void addProgressListener(IChartProgressListener listener)
listener
- IChartProgressListener
The object being registered (null not permitted).public void removeProgressListener(IChartProgressListener listener)
listener
- IChartProgressListener
The object being deregistered (null not permitted).public void removeAllProgressListener()
public void notifyListeners(ChartProgressEvent event)
ChartProgressEvent
to all registered listeners.
event
- ChartProgressEvent
Information about the event that triggered the notification.public void titleChanged(TitleChangeEvent event)
titleChanged
in interface ITitleChangeListener
event
- TitleChangeEvent
The title change event.public void plotChanged(PlotChangeEvent event)
plotChanged
in interface IPlotChangeListener
event
- PlotChangeEvent
The plot change event.public void saveChartAsJPEG(java.lang.String filePath, int width, int height) throws java.io.IOException
filePath
- String
The image file path (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public void saveChartAsJPEG(java.io.OutputStream stream, int width, int height) throws java.io.IOException
stream
- OutputStream
An OutputStream to be written to (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public void saveChartAsJPEG(java.io.File imageFile, int width, int height) throws java.io.IOException
imageFile
- File
The image file (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public void saveChartAsPNG(java.lang.String filePath, int width, int height) throws java.io.IOException
filePath
- String
The image file path (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public void saveChartAsPNG(java.io.OutputStream stream, int width, int height) throws java.io.IOException
stream
- OutputStream
An OutputStream to be written to (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public void saveChartAsPNG(java.io.File imageFile, int width, int height) throws java.io.IOException
imageFile
- File
The image file (null not permitted).width
- int
The image width.height
- int
The image height.
java.io.IOException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object (null permitted).
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the chart is not cloneable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |