|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.AbstractCategoryItemRenderer
An abstract base class that you can use to implement a new CategoryItemRenderer.
When you create a new CategoryItemRenderer you are not required to extend this class,
but it makes the job easier.
| Field Summary |
| Fields inherited from class org.jfree.chart.renderer.AbstractRenderer |
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO |
| Constructor Summary | |
protected |
AbstractCategoryItemRenderer()
Creates a new renderer with no tool tip generator and no URL generator. |
| Method Summary | |
java.lang.Object |
clone()
Returns an independent copy of the renderer. |
void |
drawBackground(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea)
Draws a background for the data area. |
void |
drawDomainGridline(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea,
double value)
Draws a grid line against the domain axis. |
protected void |
drawItemLabel(java.awt.Graphics2D g2,
PlotOrientation orientation,
CategoryDataset dataset,
int row,
int column,
double x,
double y,
boolean negative)
Draws an item label. |
void |
drawOutline(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea)
Draws an outline for the data area. |
void |
drawRangeGridline(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
java.awt.geom.Rectangle2D dataArea,
double value)
Draws a grid line against the range axis. |
void |
drawRangeMarker(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
Marker marker,
java.awt.geom.Rectangle2D dataArea)
Draws a marker for the range axis. |
boolean |
equals(java.lang.Object obj)
Tests this renderer for equality with another object. |
CategoryURLGenerator |
getBaseItemURLGenerator()
Returns the base item URL generator. |
CategoryLabelGenerator |
getBaseLabelGenerator()
Returns the base label generator. |
CategoryToolTipGenerator |
getBaseToolTipGenerator()
Returns the base tool tip generator (the "layer 2" generator). |
int |
getColumnCount()
Returns the number of columns in the dataset. |
protected CategoryAxis |
getDomainAxis(CategoryPlot plot,
int index)
Returns a domain axis for a plot. |
DrawingSupplier |
getDrawingSupplier()
Returns the drawing supplier from the plot. |
CategoryURLGenerator |
getItemURLGenerator(int row,
int column)
Returns the URL generator for a data item. |
CategoryLabelGenerator |
getLabelGenerator(int row,
int column)
Returns the label generator for a data item. |
LegendItem |
getLegendItem(int datasetIndex,
int series)
Returns a legend item for a series. |
CategoryPlot |
getPlot()
Returns the plot that the renderer has been assigned to (where null indicates
that the renderer is not currently assigned to a plot). |
protected ValueAxis |
getRangeAxis(CategoryPlot plot,
int index)
Returns a range axis for a plot. |
Range |
getRangeExtent(CategoryDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset. |
int |
getRowCount()
Returns the number of rows in the dataset. |
CategoryURLGenerator |
getSeriesItemURLGenerator(int series)
Returns the URL generator for a series. |
CategoryLabelGenerator |
getSeriesLabelGenerator(int series)
Returns the label generator for a series. |
CategoryToolTipGenerator |
getSeriesToolTipGenerator(int series)
Returns the tool tip generator for the specified series (a "layer 1" generator). |
CategoryToolTipGenerator |
getToolTipGenerator()
Returns the tool tip generator that will be used for ALL items in the dataset (the "layer 0" generator). |
CategoryToolTipGenerator |
getToolTipGenerator(int row,
int column)
Returns the tool tip generator that should be used for the specified item. |
int |
hashCode()
Returns a hash code for the renderer. |
CategoryItemRendererState |
initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
int rendererIndex,
PlotRenderingInfo info)
Initialises the renderer and returns a state object that will be used for the remainder of the drawing process for a single chart. |
void |
setBaseItemURLGenerator(CategoryURLGenerator generator)
Sets the base item URL generator. |
void |
setBaseLabelGenerator(CategoryLabelGenerator generator)
Sets the base label generator and sends a RendererChangeEvent
to all registered listeners. |
void |
setBaseToolTipGenerator(CategoryToolTipGenerator generator)
Sets the base tool tip generator and sends a RendererChangeEvent to all registered listeners. |
void |
setItemURLGenerator(CategoryURLGenerator generator)
Sets the item URL generator for ALL series. |
void |
setLabelGenerator(CategoryLabelGenerator generator)
Sets the label generator for ALL series and sends a RendererChangeEvent
to all registered listeners. |
void |
setPlot(CategoryPlot plot)
Sets the plot that the renderer has been assigned to. |
void |
setSeriesItemURLGenerator(int series,
CategoryURLGenerator generator)
Sets the URL generator for a series. |
void |
setSeriesLabelGenerator(int series,
CategoryLabelGenerator generator)
Sets the label generator for a series and sends a RendererChangeEvent
to all registered listeners. |
void |
setSeriesToolTipGenerator(int series,
CategoryToolTipGenerator generator)
Sets the tool tip generator for a series and sends a RendererChangeEvent to all registered listeners. |
void |
setToolTipGenerator(CategoryToolTipGenerator generator)
Sets the tool tip generator for ALL series and sends a RendererChangeEvent to all registered listeners. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected AbstractCategoryItemRenderer()
The defaults (no tool tip or URL generators) have been chosen to minimise the processing required to generate a default chart. If you require tool tips or URLs, then you can easily add the required generators.
| Method Detail |
public CategoryPlot getPlot()
null indicates
that the renderer is not currently assigned to a plot).
getPlot in interface CategoryItemRenderernull).public void setPlot(CategoryPlot plot)
CategoryPlot, in normal usage you shouldn't need to call this method
directly.
setPlot in interface CategoryItemRendererplot - the plot (null not permitted).
public CategoryLabelGenerator getLabelGenerator(int row,
int column)
getSeriesLabelGenerator(int) method. If, for some reason, you want a different
generator for individual items, you can override this method.
getLabelGenerator in interface CategoryItemRendererrow - the row index (zero based).column - the column index (zero based).
null).public CategoryLabelGenerator getSeriesLabelGenerator(int series)
getSeriesLabelGenerator in interface CategoryItemRendererseries - the series index (zero based).
null).public void setLabelGenerator(CategoryLabelGenerator generator)
RendererChangeEvent
to all registered listeners.
setLabelGenerator in interface CategoryItemRenderergenerator - the generator (null permitted).
public void setSeriesLabelGenerator(int series,
CategoryLabelGenerator generator)
RendererChangeEvent
to all registered listeners.
setSeriesLabelGenerator in interface CategoryItemRendererseries - the series index (zero based).generator - the generator (null permitted).public CategoryLabelGenerator getBaseLabelGenerator()
getBaseLabelGenerator in interface CategoryItemRenderernull).public void setBaseLabelGenerator(CategoryLabelGenerator generator)
RendererChangeEvent
to all registered listeners.
setBaseLabelGenerator in interface CategoryItemRenderergenerator - the generator (null permitted).
public CategoryToolTipGenerator getToolTipGenerator(int row,
int column)
getToolTipGenerator in interface CategoryItemRendererrow - the row index (zero-based).column - the column index (zero-based).
null).public CategoryToolTipGenerator getToolTipGenerator()
getToolTipGenerator in interface CategoryItemRenderernull).public void setToolTipGenerator(CategoryToolTipGenerator generator)
RendererChangeEvent to all registered listeners.
setToolTipGenerator in interface CategoryItemRenderergenerator - the generator (null permitted).public CategoryToolTipGenerator getSeriesToolTipGenerator(int series)
getSeriesToolTipGenerator in interface CategoryItemRendererseries - the series index (zero-based).
null).
public void setSeriesToolTipGenerator(int series,
CategoryToolTipGenerator generator)
RendererChangeEvent to all registered listeners.
setSeriesToolTipGenerator in interface CategoryItemRendererseries - the series index (zero-based).generator - the generator (null permitted).public CategoryToolTipGenerator getBaseToolTipGenerator()
getBaseToolTipGenerator in interface CategoryItemRenderernull).public void setBaseToolTipGenerator(CategoryToolTipGenerator generator)
RendererChangeEvent to all registered listeners.
setBaseToolTipGenerator in interface CategoryItemRenderergenerator - the generator (null permitted).
public CategoryURLGenerator getItemURLGenerator(int row,
int column)
getItemURLGenerator in interface CategoryItemRendererrow - the row index (zero based).column - the column index (zero based).
public CategoryURLGenerator getSeriesItemURLGenerator(int series)
getSeriesItemURLGenerator in interface CategoryItemRendererseries - the series index (zero based).
public void setItemURLGenerator(CategoryURLGenerator generator)
setItemURLGenerator in interface CategoryItemRenderergenerator - the generator.
public void setSeriesItemURLGenerator(int series,
CategoryURLGenerator generator)
setSeriesItemURLGenerator in interface CategoryItemRendererseries - the series index (zero based).generator - the generator.public CategoryURLGenerator getBaseItemURLGenerator()
getBaseItemURLGenerator in interface CategoryItemRendererpublic void setBaseItemURLGenerator(CategoryURLGenerator generator)
setBaseItemURLGenerator in interface CategoryItemRenderergenerator - the item URL generator.public int getRowCount()
initialise(java.awt.Graphics2D, java.awt.geom.Rectangle2D, org.jfree.chart.plot.CategoryPlot, int, org.jfree.chart.plot.PlotRenderingInfo) method.
public int getColumnCount()
initialise(java.awt.Graphics2D, java.awt.geom.Rectangle2D, org.jfree.chart.plot.CategoryPlot, int, org.jfree.chart.plot.PlotRenderingInfo) method.
public CategoryItemRendererState initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
int rendererIndex,
PlotRenderingInfo info)
Stores a reference to the PlotRenderingInfo object (which might be
null), and then sets the useCategoriesPaint flag according to the special case
conditions a) there is only one series and b) the categoriesPaint array is not null.
initialise in interface CategoryItemRendererg2 - the graphics device.dataArea - the data area.plot - the plot.rendererIndex - the renderer index.info - an object for returning information about the structure of the plot
(null permitted).
public Range getRangeExtent(CategoryDataset dataset)
getRangeExtent in interface CategoryItemRendererdataset - the dataset (null permitted).
null if the dataset is null or empty).
public void drawBackground(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea)
drawBackground in interface CategoryItemRendererg2 - the graphics device.plot - the plot.dataArea - the data area.
public void drawOutline(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea)
drawOutline in interface CategoryItemRendererg2 - the graphics device.plot - the plot.dataArea - the data area.
public void drawDomainGridline(java.awt.Graphics2D g2,
CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea,
double value)
Note that this default implementation assumes that the horizontal axis is the domain axis. If this is not the case, you will need to override this method.
drawDomainGridline in interface CategoryItemRendererg2 - the graphics device.plot - the plot.dataArea - the area for plotting data (not yet adjusted for any 3D effect).value - the Java2D value at which the grid line should be drawn.
public void drawRangeGridline(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
java.awt.geom.Rectangle2D dataArea,
double value)
drawRangeGridline in interface CategoryItemRendererg2 - the graphics device.plot - the plot.axis - the value axis.dataArea - the area for plotting data (not yet adjusted for any 3D effect).value - the value at which the grid line should be drawn.
public void drawRangeMarker(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
Marker marker,
java.awt.geom.Rectangle2D dataArea)
drawRangeMarker in interface CategoryItemRendererg2 - the graphics device (not null).plot - the plot (not null).axis - the range axis (not null).marker - the marker to be drawn (not null).dataArea - the area inside the axes (not null).
public LegendItem getLegendItem(int datasetIndex,
int series)
getLegendItem in interface CategoryItemRendererdatasetIndex - the dataset index (zero-based).series - the series index (zero-based).
public boolean equals(java.lang.Object obj)
equals in class AbstractRendererobj - the object.
true or false.public int hashCode()
hashCode in class AbstractRendererpublic DrawingSupplier getDrawingSupplier()
getDrawingSupplier in class AbstractRenderernull).
protected void drawItemLabel(java.awt.Graphics2D g2,
PlotOrientation orientation,
CategoryDataset dataset,
int row,
int column,
double x,
double y,
boolean negative)
g2 - the graphics device.orientation - the orientation.dataset - the dataset.row - the row.column - the column.x - the x coordinate (in Java2D space).y - the y coordinate (in Java2D space).negative - indicates a negative value (which affects the item label position).
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
The plot reference is shallow copied.
clone in class AbstractRendererjava.lang.CloneNotSupportedException - can be thrown if one of the objects belonging to the
renderer does not support cloning (for example, an item label generator).
protected CategoryAxis getDomainAxis(CategoryPlot plot,
int index)
plot - the plot.index - the axis index.
protected ValueAxis getRangeAxis(CategoryPlot plot,
int index)
plot - the plot.index - the axis index (null for the primary axis).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||