|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.jrefinery.chart.Plot
public abstract class Plot
The base class for all plots in JFreeChart. The JFreeChart class delegates the drawing of axes and data to the plot. This base class provides facilities common to most plot types.
| Field Summary | |
|---|---|
protected float |
backgroundAlpha
The alpha transparency for the background paint. |
protected java.awt.Image |
backgroundImage
An optional image for the plot background. |
protected java.awt.Paint |
backgroundPaint
An optional color used to fill the plot background. |
protected Dataset |
dataset
The data. |
protected static float |
DEFAULT_BACKGROUND_ALPHA
The default background alpha transparency. |
protected static java.awt.Paint |
DEFAULT_BACKGROUND_PAINT
The default background color. |
protected static float |
DEFAULT_FOREGROUND_ALPHA
The default foreground alpha transparency. |
protected static java.awt.Insets |
DEFAULT_INSETS
The default insets. |
protected static java.awt.Paint |
DEFAULT_OUTLINE_PAINT
The default outline color. |
protected static java.awt.Stroke |
DEFAULT_OUTLINE_STROKE
The default outline stroke. |
protected int |
firstSeriesIndex
The index of the first series. |
protected float |
foregroundAlpha
The alpha-transparency for the plot. |
protected java.awt.Insets |
insets
Amount of blank space around the plot area. |
protected java.util.List |
listeners
Storage for registered change listeners. |
protected static int |
MINIMUM_HEIGHT_TO_DRAW
The minimum height for the plot, any less space than this and it should not be drawn (not fully implemented. |
protected static int |
MINIMUM_WIDTH_TO_DRAW
The minimum width for the plot, any less space than this and it should not be drawn (not fully implemented). |
protected java.awt.Paint |
outlinePaint
The Paint used to draw an outline around the plot. |
protected java.awt.Stroke |
outlineStroke
The Stroke used to draw an outline around the plot. |
protected java.awt.Paint[] |
seriesOutlinePaint
Paint objects used to draw the outline of each series in the chart. |
protected java.awt.Stroke[] |
seriesOutlineStroke
Stroke objects used to draw the outline of each series in the chart. |
protected java.awt.Paint[] |
seriesPaint
Paint objects used to color each series in the chart. |
protected java.awt.Stroke[] |
seriesStroke
Stroke objects used to draw each series in the chart. |
protected ShapeFactory |
shapeFactory
Factory for shapes used to represent data points |
static java.lang.Number |
ZERO
Useful constant representing zero. |
| Fields inherited from interface com.jrefinery.chart.AxisConstants |
|---|
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_STROKE |
| Constructor Summary | |
|---|---|
protected |
Plot()
Constructs a new plot with the specified axes. |
protected |
Plot(Dataset data)
|
protected |
Plot(Dataset data,
java.awt.Insets insets,
java.awt.Paint backgroundPaint,
java.awt.Image backgroundImage,
float backgroundAlpha,
java.awt.Stroke outlineStroke,
java.awt.Paint outlinePaint,
float foregroundAlpha)
Constructs a new plot. |
| Method Summary | |
|---|---|
void |
addChangeListener(com.jrefinery.chart.event.PlotChangeListener listener)
Registers an object for notification of changes to the plot. |
void |
axisChanged(com.jrefinery.chart.event.AxisChangeEvent event)
Receives notification of a change to one of the plot's axes. |
void |
datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset. |
protected abstract void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
ChartRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer). |
void |
drawOutlineAndBackground(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Draw the plot outline and background. |
float |
getBackgroundAlpha()
Returns the alpha transparency of the plot area background. |
java.awt.Paint |
getBackgroundPaint()
Returns the background color of the plot area. |
Dataset |
getDataset()
Returns the dataset for the plot. |
int |
getFirstSeriesIndex()
Returns the index of the first series. |
float |
getForegroundAlpha()
Returns the alpha-transparency for the plot foreground. |
java.awt.Insets |
getInsets()
Returns the insets for the plot area. |
abstract java.util.List |
getLegendItemLabels()
|
java.awt.Paint |
getOutlinePaint()
Returns the color used to draw the outline of the plot area. |
java.awt.Stroke |
getOutlineStroke()
Returns the pen/brush used to outline the plot area. |
abstract java.lang.String |
getPlotType()
Returns a short string describing the plot type. |
java.awt.Paint |
getSeriesOutlinePaint(int index)
Returns the Paint used to outline any shapes for the specified series. |
java.awt.Stroke |
getSeriesOutlineStroke(int index)
Returns the Stroke used to outline any shapes for the specified series. |
java.awt.Paint |
getSeriesPaint(int index)
Returns a Paint object used as the main color for a series. |
java.awt.Stroke |
getSeriesStroke(int index)
Returns the Stroke used to draw any shapes for a series. |
java.awt.Shape |
getShape(int series,
int item,
double x,
double y,
double scale)
Returns a Shape that can be used in plotting data. |
java.awt.Shape |
getShape(int series,
java.lang.Object category,
double x,
double y,
double scale)
Returns a Shape that can be used in plotting data. |
ShapeFactory |
getShapeFactory()
Returns the object used to generate shapes for marking data points |
void |
handleClick(int x,
int y,
ChartRenderingInfo info)
Handles a 'click' on the plot. |
boolean |
isSubplot()
Returns true if this plot is part of a combined plot structure, and false otherwise. |
void |
notifyListeners(com.jrefinery.chart.event.PlotChangeEvent event)
Notifies all registered listeners that the plot has been modified. |
void |
removeChangeListener(com.jrefinery.chart.event.PlotChangeListener listener)
Unregisters an object for notification of changes to the plot. |
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 plot. |
void |
setBackgroundPaint(java.awt.Paint paint)
Sets the background color of the plot area, and notifies registered listeners that the plot has been modified. |
void |
setDataset(Dataset data)
Sets the data for the chart, replacing any existing data. |
void |
setFirstSeriesIndex(int index)
Sets the index of the first series. |
void |
setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot. |
void |
setInsets(java.awt.Insets insets)
Sets the insets for the plot and notifies registered listeners that the plot has been modified. |
void |
setOutlinePaint(java.awt.Paint paint)
Sets the color of the outline of the plot area, and notifies registered listeners that the Plot has been modified. |
void |
setOutlineStroke(java.awt.Stroke stroke)
Sets the pen/brush used to outline the plot area, and notifies registered listeners that the plot has been modified. |
void |
setSeriesOutlinePaint(java.awt.Paint[] paint)
Sets the paint used to outline any shapes representing series, and notifies registered listeners that the chart has been modified. |
void |
setSeriesOutlineStroke(int index,
java.awt.Stroke stroke)
Sets the stroke used to draw any shapes representing a specific series, and notifies registered listeners that the chart has been modified. |
void |
setSeriesOutlineStroke(java.awt.Stroke[] stroke)
Sets the stroke used to draw any shapes representing series, and notifies registered listeners that the chart has been modified. |
void |
setSeriesPaint(int index,
java.awt.Paint paint)
Sets the paint used to color any shapes representing a specific series, and notifies registered listeners that the plot has been modified. |
void |
setSeriesPaint(java.awt.Paint[] paint)
Sets the paint used to color any shapes representing series, and notifies registered listeners that the plot has been modified. |
void |
setSeriesStroke(int index,
java.awt.Stroke stroke)
Sets the stroke used to draw any shapes representing a specific series, and notifies registered listeners that the chart has been modified. |
void |
setSeriesStroke(java.awt.Stroke[] stroke)
Sets the stroke used to draw any shapes representing series, and notifies registered listeners that the chart has been modified. |
void |
setShapeFactory(ShapeFactory factory)
Sets the object used to generate shapes for marking data points |
abstract void |
zoom(double percent)
Performs a zoom on the plot. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.Number ZERO
protected static final java.awt.Insets DEFAULT_INSETS
protected static final java.awt.Stroke DEFAULT_OUTLINE_STROKE
protected static final java.awt.Paint DEFAULT_OUTLINE_PAINT
protected static final float DEFAULT_FOREGROUND_ALPHA
protected static final float DEFAULT_BACKGROUND_ALPHA
protected static final java.awt.Paint DEFAULT_BACKGROUND_PAINT
protected static final int MINIMUM_WIDTH_TO_DRAW
protected static final int MINIMUM_HEIGHT_TO_DRAW
protected Dataset dataset
protected int firstSeriesIndex
protected java.awt.Insets insets
protected java.awt.Stroke outlineStroke
protected java.awt.Paint outlinePaint
protected java.awt.Paint backgroundPaint
protected java.awt.Image backgroundImage
protected float foregroundAlpha
protected float backgroundAlpha
protected java.awt.Paint[] seriesPaint
protected java.awt.Stroke[] seriesStroke
protected java.awt.Paint[] seriesOutlinePaint
protected java.awt.Stroke[] seriesOutlineStroke
protected java.util.List listeners
protected ShapeFactory shapeFactory
| Constructor Detail |
|---|
protected Plot()
data - The dataset.horizontalAxis - The horizontal axis.verticalAxis - The vertical axis.protected Plot(Dataset data)
protected Plot(Dataset data,
java.awt.Insets insets,
java.awt.Paint backgroundPaint,
java.awt.Image backgroundImage,
float backgroundAlpha,
java.awt.Stroke outlineStroke,
java.awt.Paint outlinePaint,
float foregroundAlpha)
data - The dataset.insets - Amount of blank space around the plot area.backgroundPaint - An optional color for the plot's background.backgroundImage - An optional image for the plot's background.backgroundAlpha - Alpha-transparency for the plot's background.outlineStroke - The Stroke used to draw an outline around the plot.outlinePaint - The color used to draw an outline around the plot.foregroundAlpha - The alpha-transparency for the plot foreground.| Method Detail |
|---|
public abstract java.lang.String getPlotType()
Note: this gets used in the chart property editing user interface, but there needs to be a better mechanism for identifying the plot type.
public Dataset getDataset()
public void setDataset(Dataset data)
The plot is automatically registered with the new dataset, to listen for any changes.
data - The new dataset.public boolean isSubplot()
public int getFirstSeriesIndex()
public void setFirstSeriesIndex(int index)
index - The new index.public java.awt.Insets getInsets()
public void setInsets(java.awt.Insets insets)
insets - The new insets.public java.awt.Paint getBackgroundPaint()
public void setBackgroundPaint(java.awt.Paint paint)
paint - The new background color (null permitted).public float getBackgroundAlpha()
public void setBackgroundAlpha(float alpha)
alpha - The new alpha value.public void setBackgroundImage(java.awt.Image image)
image - The background image.public java.awt.Stroke getOutlineStroke()
public void setOutlineStroke(java.awt.Stroke stroke)
stroke - The new outline pen/brush (null permitted).public java.awt.Paint getOutlinePaint()
public void setOutlinePaint(java.awt.Paint paint)
paint - The new outline paint (null permitted).public float getForegroundAlpha()
public void setForegroundAlpha(float alpha)
alpha - The new alpha transparency.public abstract java.util.List getLegendItemLabels()
public java.awt.Paint getSeriesPaint(int index)
index - The series index (zero-based).public void setSeriesPaint(java.awt.Paint[] paint)
paint - An array of Paint objects used to color series.
public void setSeriesPaint(int index,
java.awt.Paint paint)
index - The series index (zero-based)paint - An array of Paint objects used to color series.public java.awt.Stroke getSeriesStroke(int index)
index - The series (zero-based index).public void setSeriesStroke(java.awt.Stroke[] stroke)
stroke - An array of Stroke objects used to draw series.
public void setSeriesStroke(int index,
java.awt.Stroke stroke)
index - The series index (zero-based)stroke - An array of Stroke objects used to draw series.public java.awt.Paint getSeriesOutlinePaint(int index)
index - The index of the series of interest (zero-based);public void setSeriesOutlinePaint(java.awt.Paint[] paint)
paint - An array of Paint objects for drawing the outline of series shapes;public java.awt.Stroke getSeriesOutlineStroke(int index)
index - The index of the series of interest (zero-based);public void setSeriesOutlineStroke(java.awt.Stroke[] stroke)
stroke - An array of Stroke objects;
public void setSeriesOutlineStroke(int index,
java.awt.Stroke stroke)
index - The series index (zero-based)stroke - An array of Stroke objects;public ShapeFactory getShapeFactory()
public void setShapeFactory(ShapeFactory factory)
factory - The new shape factory.
public java.awt.Shape getShape(int series,
int item,
double x,
double y,
double scale)
public java.awt.Shape getShape(int series,
java.lang.Object category,
double x,
double y,
double scale)
public void notifyListeners(com.jrefinery.chart.event.PlotChangeEvent event)
event - Information about the change event.public void addChangeListener(com.jrefinery.chart.event.PlotChangeListener listener)
listener - The object to be registered.public void removeChangeListener(com.jrefinery.chart.event.PlotChangeListener listener)
listener - The object to be unregistered.
protected abstract void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
ChartRenderingInfo info)
This class does not store any information about where the individual items that make up the plot are actually drawn. If you want to collect this information, pass in a ChartRenderingInfo object. After the drawing is complete, the info object will contain lots of information about the chart. If you don't want the information, pass in null. *
g2 - The graphics device.plotArea - The area within which the plot should be drawn.info - An object for collecting information about the drawing of the chart.
public void drawOutlineAndBackground(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
g2 - The graphics device.area - The area within which the plot should be drawn.
public void handleClick(int x,
int y,
ChartRenderingInfo info)
x - The x coordinate.y - The y coordinate.plotArea - The area in which the plot is assumed to be drawn.public abstract void zoom(double percent)
The - zoom percentage.public void axisChanged(com.jrefinery.chart.event.AxisChangeEvent event)
axisChanged in interface com.jrefinery.chart.event.AxisChangeListenerevent - Information about the event (not used here).public void datasetChanged(DatasetChangeEvent event)
The plot reacts by passing on a plot change event to all registered listeners.
datasetChanged in interface DatasetChangeListenerevent - Information about the event (not used here).
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||