org.jfree.chart.renderer.xy.XYItemRenderer Maven / Gradle / Ivy
Show all versions of jfreechart Show documentation
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-present, by David Gilbert and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.]
*
* -------------------
* XYItemRenderer.java
* -------------------
* (C) Copyright 2001-present, by David Gilbert and Contributors.
*
* Original Author: David Gilbert;
* Contributor(s): Mark Watson (www.markwatson.com);
* Sylvain Vieujot;
* Focus Computer Services Limited;
* Richard Atkinson;
*
*/
package org.jfree.chart.renderer.xy;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Rectangle2D;
import org.jfree.chart.LegendItem;
import org.jfree.chart.LegendItemSource;
import org.jfree.chart.annotations.XYAnnotation;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.event.RendererChangeEvent;
import org.jfree.chart.event.RendererChangeListener;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.XYItemLabelGenerator;
import org.jfree.chart.labels.XYSeriesLabelGenerator;
import org.jfree.chart.labels.XYToolTipGenerator;
import org.jfree.chart.plot.CrosshairState;
import org.jfree.chart.plot.Marker;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.Layer;
import org.jfree.chart.urls.XYURLGenerator;
import org.jfree.data.Range;
import org.jfree.data.xy.XYDataset;
/**
* Interface for rendering the visual representation of a single (x, y) item on
* an {@link XYPlot}.
*
* To support cloning charts, it is recommended that renderers implement both
* the {@link Cloneable} and {@code PublicCloneable} interfaces.
*/
public interface XYItemRenderer extends LegendItemSource {
/**
* Returns the plot that this renderer has been assigned to.
*
* @return The plot.
*/
XYPlot getPlot();
/**
* Sets the plot that this renderer is assigned to. This method will be
* called by the plot class...you do not need to call it yourself.
*
* @param plot the plot.
*/
void setPlot(XYPlot plot);
/**
* Returns the number of passes through the data required by the renderer.
*
* @return The pass count.
*/
int getPassCount();
/**
* Returns the lower and upper bounds (range) of the x-values in the
* specified dataset.
*
* @param dataset the dataset ({@code null} permitted).
*
* @return The range.
*/
Range findDomainBounds(XYDataset dataset);
/**
* Returns the lower and upper bounds (range) of the y-values in the
* specified dataset. The implementation of this method will take
* into account the presentation used by the renderers (for example,
* a renderer that "stacks" values will return a bigger range than
* a renderer that doesn't).
*
* @param dataset the dataset ({@code null} permitted).
*
* @return The range (or {@code null} if the dataset is
* {@code null} or empty).
*/
Range findRangeBounds(XYDataset dataset);
/**
* Add a renderer change listener.
*
* @param listener the listener.
*
* @see #removeChangeListener(RendererChangeListener)
*/
void addChangeListener(RendererChangeListener listener);
/**
* Removes a change listener.
*
* @param listener the listener.
*
* @see #addChangeListener(RendererChangeListener)
*/
void removeChangeListener(RendererChangeListener listener);
//// VISIBLE //////////////////////////////////////////////////////////////
/**
* Returns a boolean that indicates whether or not the specified item
* should be drawn (this is typically used to hide an entire series).
*
* @param series the series index.
* @param item the item index.
*
* @return A boolean.
*/
boolean getItemVisible(int series, int item);
/**
* Returns a boolean that indicates whether or not the specified series
* should be drawn (this is typically used to hide an entire series).
*
* @param series the series index.
*
* @return A boolean.
*/
boolean isSeriesVisible(int series);
/**
* Returns the flag that controls whether a series is visible.
*
* @param series the series index (zero-based).
*
* @return The flag (possibly {@code null}).
*
* @see #setSeriesVisible(int, Boolean)
*/
Boolean getSeriesVisible(int series);
/**
* Sets the flag that controls whether a series is visible and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param visible the flag ({@code null} permitted).
*
* @see #getSeriesVisible(int)
*/
void setSeriesVisible(int series, Boolean visible);
/**
* Sets the flag that controls whether a series is visible and, if
* requested, sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param series the series index.
* @param visible the flag ({@code null} permitted).
* @param notify notify listeners?
*
* @see #getSeriesVisible(int)
*/
void setSeriesVisible(int series, Boolean visible, boolean notify);
/**
* Returns the default visibility for all series.
*
* @return The default visibility.
*
* @see #setDefaultSeriesVisible(boolean)
*/
boolean getDefaultSeriesVisible();
/**
* Sets the default visibility and sends a {@link RendererChangeEvent} to all
* registered listeners.
*
* @param visible the flag.
*
* @see #getDefaultSeriesVisible()
*/
void setDefaultSeriesVisible(boolean visible);
/**
* Sets the default visibility and, if requested, sends
* a {@link RendererChangeEvent} to all registered listeners.
*
* @param visible the visibility.
* @param notify notify listeners?
*
* @see #getDefaultSeriesVisible()
*/
void setDefaultSeriesVisible(boolean visible, boolean notify);
// SERIES VISIBLE IN LEGEND (not yet respected by all renderers)
/**
* Returns {@code true} if the series should be shown in the legend,
* and {@code false} otherwise.
*
* @param series the series index.
*
* @return A boolean.
*/
boolean isSeriesVisibleInLegend(int series);
/**
* Returns the flag that controls whether a series is visible in the
* legend. This method returns only the "per series" settings - to
* incorporate the override and base settings as well, you need to use the
* {@link #isSeriesVisibleInLegend(int)} method.
*
* @param series the series index (zero-based).
*
* @return The flag (possibly {@code null}).
*
* @see #setSeriesVisibleInLegend(int, Boolean)
*/
Boolean getSeriesVisibleInLegend(int series);
/**
* Sets the flag that controls whether a series is visible in the legend
* and sends a {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param visible the flag ({@code null} permitted).
*
* @see #getSeriesVisibleInLegend(int)
*/
void setSeriesVisibleInLegend(int series, Boolean visible);
/**
* Sets the flag that controls whether a series is visible in the legend
* and, if requested, sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param series the series index.
* @param visible the flag ({@code null} permitted).
* @param notify notify listeners?
*
* @see #getSeriesVisibleInLegend(int)
*/
void setSeriesVisibleInLegend(int series, Boolean visible,
boolean notify);
/**
* Returns the default visibility in the legend for all series.
*
* @return The default visibility.
*
* @see #setDefaultSeriesVisibleInLegend(boolean)
*/
boolean getDefaultSeriesVisibleInLegend();
/**
* Sets the default visibility in the legend and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param visible the flag.
*
* @see #getDefaultSeriesVisibleInLegend()
*/
void setDefaultSeriesVisibleInLegend(boolean visible);
/**
* Sets the default visibility in the legend and, if requested, sends
* a {@link RendererChangeEvent} to all registered listeners.
*
* @param visible the visibility.
* @param notify notify listeners?
*
* @see #getDefaultSeriesVisibleInLegend()
*/
void setDefaultSeriesVisibleInLegend(boolean visible, boolean notify);
//// PAINT ////////////////////////////////////////////////////////////////
/**
* Returns the paint used to color data items as they are drawn.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The paint (never {@code null}).
*/
Paint getItemPaint(int row, int column);
/**
* Returns the paint used to color an item drawn by the renderer.
*
* @param series the series index (zero-based).
*
* @return The paint (possibly {@code null}).
*
* @see #setSeriesPaint(int, Paint)
*/
Paint getSeriesPaint(int series);
/**
* Sets the paint used for a series and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
*
* @see #getSeriesPaint(int)
*/
void setSeriesPaint(int series, Paint paint);
/**
* Sets the paint used for a series and sends a {@link RendererChangeEvent}
* to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
* @param notify send a change event?
*
* @see #getSeriesPaint(int)
*/
void setSeriesPaint(int series, Paint paint, boolean notify);
/**
* Returns the default paint.
*
* @return The default paint (never {@code null}).
*
* @see #setDefaultPaint(Paint)
*/
Paint getDefaultPaint();
/**
* Sets the default paint and sends a {@link RendererChangeEvent} to all
* registered listeners.
*
* @param paint the paint ({@code null} not permitted).
*
* @see #getDefaultPaint()
*/
void setDefaultPaint(Paint paint);
/**
* Sets the default paint and sends a {@link RendererChangeEvent} to all
* registered listeners if requested.
*
* @param paint the paint ({@code null} not permitted).
* @param notify send a change event?
*
* @see #getDefaultPaint()
*/
void setDefaultPaint(Paint paint, boolean notify);
// FILL PAINT
/**
* Returns the paint used to fill data items as they are drawn.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The paint (never {@code null}).
*/
Paint getItemFillPaint(int row, int column);
/**
* Returns the paint used to fill an item drawn by the renderer.
*
* @param series the series index (zero-based).
*
* @return The paint (possibly {@code null}).
*/
Paint getSeriesFillPaint(int series);
/**
* Sets the paint used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
*/
void setSeriesFillPaint(int series, Paint paint);
/**
* Sets the paint used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
* @param notify send a change event?
*/
void setSeriesFillPaint(int series, Paint paint, boolean notify);
/**
* Returns the default paint.
*
* @return The default paint (never {@code null}).
*/
Paint getDefaultFillPaint();
/**
* Sets the default paint and sends a {@link RendererChangeEvent} to all
* registered listeners.
*
* @param paint the paint ({@code null} not permitted).
*/
void setDefaultFillPaint(Paint paint);
/**
* Sets the default paint and sends a {@link RendererChangeEvent} to all
* registered listeners if requested.
*
* @param paint the paint ({@code null} not permitted).
* @param notify send a change event?
*/
void setDefaultFillPaint(Paint paint, boolean notify);
//// OUTLINE PAINT ////////////////////////////////////////////////////////
/**
* Returns the paint used to outline data items as they are drawn.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The paint (never {@code null}).
*/
Paint getItemOutlinePaint(int row, int column);
/**
* Returns the paint used to outline an item drawn by the renderer.
*
* @param series the series (zero-based index).
*
* @return The paint (possibly {@code null}).
*
* @see #setSeriesOutlinePaint(int, Paint)
*/
Paint getSeriesOutlinePaint(int series);
/**
* Sets the paint used for a series outline and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
*
* @see #getSeriesOutlinePaint(int)
*/
void setSeriesOutlinePaint(int series, Paint paint);
/**
* Sets the paint used for a series outline and sends a
* {@link RendererChangeEvent} to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param paint the paint ({@code null} permitted).
* @param notify send a change event?
*
* @see #getSeriesOutlinePaint(int)
*/
void setSeriesOutlinePaint(int series, Paint paint, boolean notify);
/**
* Returns the default outline paint.
*
* @return The paint (never {@code null}).
*
* @see #setDefaultOutlinePaint(Paint)
*/
Paint getDefaultOutlinePaint();
/**
* Sets the default outline paint and sends a {@link RendererChangeEvent} to
* all registered listeners.
*
* @param paint the paint ({@code null} not permitted).
*
* @see #getDefaultOutlinePaint()
*/
void setDefaultOutlinePaint(Paint paint);
/**
* Sets the default outline paint and sends a {@link RendererChangeEvent} to
* all registered listeners if requested.
*
* @param paint the paint ({@code null} not permitted).
* @param notify send a change event?
*
* @see #getDefaultOutlinePaint()
*/
void setDefaultOutlinePaint(Paint paint, boolean notify);
//// STROKE ///////////////////////////////////////////////////////////////
/**
* Returns the stroke used to draw data items.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The stroke (never {@code null}).
*/
Stroke getItemStroke(int row, int column);
/**
* Returns the stroke used to draw the items in a series.
*
* @param series the series (zero-based index).
*
* @return The stroke (possibly {@code null}).
*
* @see #setSeriesStroke(int, Stroke)
*/
Stroke getSeriesStroke(int series);
/**
* Sets the stroke used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param stroke the stroke ({@code null} permitted).
*
* @see #getSeriesStroke(int)
*/
void setSeriesStroke(int series, Stroke stroke);
/**
* Sets the stroke used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param stroke the stroke ({@code null} permitted).
* @param notify send a change event?
*
* @see #getSeriesStroke(int)
*/
void setSeriesStroke(int series, Stroke stroke, boolean notify);
/**
* Returns the default stroke.
*
* @return The default stroke (never {@code null}).
*
* @see #setDefaultStroke(Stroke)
*/
Stroke getDefaultStroke();
/**
* Sets the default stroke and sends a {@link RendererChangeEvent} to all
* registered listeners.
*
* @param stroke the stroke ({@code null} not permitted).
*
* @see #getDefaultStroke()
*/
void setDefaultStroke(Stroke stroke);
/**
* Sets the default stroke and sends a {@link RendererChangeEvent} to all
* registered listeners if requested.
*
* @param stroke the stroke ({@code null} not permitted).
* @param notify send a change event?
*
* @see #getDefaultStroke()
*/
void setDefaultStroke(Stroke stroke, boolean notify);
//// OUTLINE STROKE ///////////////////////////////////////////////////////
/**
* Returns the stroke used to outline data items. The default
* implementation passes control to the lookupSeriesOutlineStroke method.
* You can override this method if you require different behaviour.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The stroke (never {@code null}).
*/
Stroke getItemOutlineStroke(int row, int column);
/**
* Returns the stroke used to outline the items in a series.
*
* @param series the series (zero-based index).
*
* @return The stroke (possibly {@code null}).
*
* @see #setSeriesOutlineStroke(int, Stroke)
*/
Stroke getSeriesOutlineStroke(int series);
/**
* Sets the outline stroke used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param stroke the stroke ({@code null} permitted).
*
* @see #getSeriesOutlineStroke(int)
*/
void setSeriesOutlineStroke(int series, Stroke stroke);
/**
* Sets the outline stroke used for a series and sends a
* {@link RendererChangeEvent} to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param stroke the stroke ({@code null} permitted).
* @param notify send a change event?
*
* @see #getSeriesOutlineStroke(int)
*/
void setSeriesOutlineStroke(int series, Stroke stroke, boolean notify);
/**
* Returns the default outline stroke.
*
* @return The stroke (never {@code null}).
*
* @see #setDefaultOutlineStroke(Stroke)
*/
Stroke getDefaultOutlineStroke();
/**
* Sets the base outline stroke and sends a {@link RendererChangeEvent} to
* all registered listeners.
*
* @param stroke the stroke ({@code null} not permitted).
*
* @see #getDefaultOutlineStroke()
*/
void setDefaultOutlineStroke(Stroke stroke);
/**
* Sets the base outline stroke and sends a {@link RendererChangeEvent} to
* all registered listeners if requested.
*
* @param stroke the stroke ({@code null} not permitted).
* @param notify send a change event.
*
* @see #getDefaultOutlineStroke()
*/
void setDefaultOutlineStroke(Stroke stroke, boolean notify);
//// SHAPE ////////////////////////////////////////////////////////////////
/**
* Returns a shape used to represent a data item.
*
* @param row the row (or series) index (zero-based).
* @param column the column (or category) index (zero-based).
*
* @return The shape (never {@code null}).
*/
Shape getItemShape(int row, int column);
/**
* Returns a shape used to represent the items in a series.
*
* @param series the series (zero-based index).
*
* @return The shape (possibly {@code null}).
*
* @see #setSeriesShape(int, Shape)
*/
Shape getSeriesShape(int series);
/**
* Sets the shape used for a series and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param series the series index (zero-based).
* @param shape the shape ({@code null} permitted).
*
* @see #getSeriesShape(int)
*/
void setSeriesShape(int series, Shape shape);
/**
* Sets the shape used for a series and sends a {@link RendererChangeEvent}
* to all registered listeners if requested.
*
* @param series the series index (zero-based).
* @param shape the shape ({@code null} permitted).
* @param notify send a change event?
*
* @see #getSeriesShape(int)
*/
void setSeriesShape(int series, Shape shape, boolean notify);
/**
* Returns the default shape.
*
* @return The shape (never {@code null}).
*
* @see #setDefaultShape(Shape)
*/
Shape getDefaultShape();
/**
* Sets the default shape and sends a {@link RendererChangeEvent} to all
* registered listeners.
*
* @param shape the shape ({@code null} not permitted).
*
* @see #getDefaultShape()
*/
void setDefaultShape(Shape shape);
/**
* Sets the default shape and sends a {@link RendererChangeEvent} to all
* registered listeners if requested.
*
* @param shape the shape ({@code null} not permitted).
* @param notify send a change event?
*
* @see #getDefaultShape()
*/
void setDefaultShape(Shape shape, boolean notify);
//// LEGEND ITEMS /////////////////////////////////////////////////////////
/**
* Returns a legend item for a series from a dataset.
*
* @param datasetIndex the dataset index.
* @param series the series (zero-based index).
*
* @return The legend item (possibly {@code null}).
*/
LegendItem getLegendItem(int datasetIndex, int series);
//// LEGEND ITEM LABEL GENERATOR //////////////////////////////////////////
/**
* Returns the legend item label generator.
*
* @return The legend item label generator (never {@code null}).
*
* @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator)
*/
XYSeriesLabelGenerator getLegendItemLabelGenerator();
/**
* Sets the legend item label generator and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param generator the generator ({@code null} not permitted).
*/
void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator);
//// TOOL TIP GENERATOR ///////////////////////////////////////////////////
/**
* Returns the tool tip generator for a data item.
*
* @param row the row index (zero based).
* @param column the column index (zero based).
*
* @return The generator (possibly {@code null}).
*/
XYToolTipGenerator getToolTipGenerator(int row, int column);
/**
* Returns the tool tip generator for a series.
*
* @param series the series index (zero based).
*
* @return The generator (possibly {@code null}).
*
* @see #setSeriesToolTipGenerator(int, XYToolTipGenerator)
*/
XYToolTipGenerator getSeriesToolTipGenerator(int series);
/**
* Sets the tool tip generator for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero based).
* @param generator the generator ({@code null} permitted).
*
* @see #getSeriesToolTipGenerator(int)
*/
void setSeriesToolTipGenerator(int series,
XYToolTipGenerator generator);
/**
* Returns the default tool tip generator.
*
* @return The generator (possibly {@code null}).
*
* @see #setDefaultToolTipGenerator(XYToolTipGenerator)
*/
XYToolTipGenerator getDefaultToolTipGenerator();
/**
* Sets the default tool tip generator and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param generator the generator ({@code null} permitted).
*
* @see #getDefaultToolTipGenerator()
*/
void setDefaultToolTipGenerator(XYToolTipGenerator generator);
//// URL GENERATOR ////////////////////////////////////////////////////////
/**
* Returns the URL generator for HTML image maps.
*
* @return The URL generator (possibly null).
*/
XYURLGenerator getURLGenerator();
/**
* Sets the URL generator for HTML image maps.
*
* @param urlGenerator the URL generator (null permitted).
*/
void setURLGenerator(XYURLGenerator urlGenerator);
//// ITEM LABELS VISIBLE //////////////////////////////////////////////////
/**
* Returns {@code true} if an item label is visible, and
* {@code false} otherwise.
*
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*
* @return A boolean.
*/
boolean isItemLabelVisible(int row, int column);
/**
* Returns {@code true} if the item labels for a series are visible,
* and {@code false} otherwise.
*
* @param series the series index (zero-based).
*
* @return A boolean.
*/
boolean isSeriesItemLabelsVisible(int series);
/**
* Sets a flag that controls the visibility of the item labels for a
* series and sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param series the series index (zero-based).
* @param visible the flag.
*
* @see #isSeriesItemLabelsVisible(int)
*/
void setSeriesItemLabelsVisible(int series, boolean visible);
/**
* Sets a flag that controls the visibility of the item labels for a series.
*
* @param series the series index (zero-based).
* @param visible the flag ({@code null} permitted).
*
* @see #isSeriesItemLabelsVisible(int)
*/
void setSeriesItemLabelsVisible(int series, Boolean visible);
/**
* Sets the visibility of item labels for a series and, if requested,
* sends a {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param visible the visible flag.
* @param notify a flag that controls whether or not listeners are
* notified.
*
* @see #isSeriesItemLabelsVisible(int)
*/
void setSeriesItemLabelsVisible(int series, Boolean visible,
boolean notify);
/**
* Returns the default setting for item label visibility.
*
* @return A flag (possibly {@code null}).
*
* @see #setDefaultItemLabelsVisible(boolean)
*/
boolean getDefaultItemLabelsVisible();
/**
* Sets the default flag that controls whether or not item labels are visible.
*
* @param visible the flag.
*
* @see #getDefaultItemLabelsVisible()
*/
void setDefaultItemLabelsVisible(boolean visible);
/**
* Sets the default visibility for item labels and, if requested, sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param visible the visibility flag.
* @param notify a flag that controls whether or not listeners are
* notified.
*
* @see #getDefaultItemLabelsVisible()
*/
void setDefaultItemLabelsVisible(boolean visible, boolean notify);
//// ITEM LABEL GENERATOR /////////////////////////////////////////////////
/**
* Returns the item label generator for a data item.
*
* @param row the row index (zero based).
* @param column the column index (zero based).
*
* @return The generator (possibly {@code null}).
*/
XYItemLabelGenerator getItemLabelGenerator(int row, int column);
/**
* Returns the item label generator for a series.
*
* @param series the series index (zero based).
*
* @return The generator (possibly {@code null}).
*
* @see #setSeriesItemLabelGenerator(int, XYItemLabelGenerator)
*/
XYItemLabelGenerator getSeriesItemLabelGenerator(int series);
/**
* Sets the item label generator for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero based).
* @param generator the generator ({@code null} permitted).
*
* @see #getSeriesItemLabelGenerator(int)
*/
void setSeriesItemLabelGenerator(int series,
XYItemLabelGenerator generator);
/**
* Returns the default item label generator.
*
* @return The generator (possibly {@code null}).
*
* @see #setDefaultItemLabelGenerator(XYItemLabelGenerator)
*/
XYItemLabelGenerator getDefaultItemLabelGenerator();
/**
* Sets the default item label generator and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param generator the generator ({@code null} permitted).
*
* @see #getDefaultItemLabelGenerator()
*/
void setDefaultItemLabelGenerator(XYItemLabelGenerator generator);
//// ITEM LABEL FONT ///////////////////////////////////////////////////////
/**
* Returns the font for an item label.
*
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*
* @return The font (never {@code null}).
*/
Font getItemLabelFont(int row, int column);
/**
* Returns the font for all the item labels in a series.
*
* @param series the series index (zero-based).
*
* @return The font (possibly {@code null}).
*/
Font getSeriesItemLabelFont(int series);
/**
* Sets the item label font for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param font the font ({@code null} permitted).
*
* @see #getSeriesItemLabelFont(int)
*/
void setSeriesItemLabelFont(int series, Font font);
/**
* Returns the default item label font (this is used when no other font
* setting is available).
*
* @return The font (never {@code null}).
*
* @see #setDefaultItemLabelFont(Font)
*/
Font getDefaultItemLabelFont();
/**
* Sets the default item label font and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param font the font ({@code null} not permitted).
*
* @see #getDefaultItemLabelFont()
*/
void setDefaultItemLabelFont(Font font);
//// ITEM LABEL PAINT /////////////////////////////////////////////////////
/**
* Returns the paint used to draw an item label.
*
* @param row the row index (zero based).
* @param column the column index (zero based).
*
* @return The paint (never {@code null}).
*/
Paint getItemLabelPaint(int row, int column);
/**
* Returns the paint used to draw the item labels for a series.
*
* @param series the series index (zero based).
*
* @return The paint (possibly {@code null}).
*
* @see #setSeriesItemLabelPaint(int, Paint)
*/
Paint getSeriesItemLabelPaint(int series);
/**
* Sets the item label paint for a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series (zero based index).
* @param paint the paint ({@code null} permitted).
*
* @see #getSeriesItemLabelPaint(int)
*/
void setSeriesItemLabelPaint(int series, Paint paint);
/**
* Returns the default item label paint.
*
* @return The paint (never {@code null}).
*/
Paint getDefaultItemLabelPaint();
/**
* Sets the default item label paint and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param paint the paint ({@code null} not permitted).
*/
void setDefaultItemLabelPaint(Paint paint);
// POSITIVE ITEM LABEL POSITION...
/**
* Returns the item label position for positive values.
*
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*
* @return The item label position (never {@code null}).
*/
ItemLabelPosition getPositiveItemLabelPosition(int row, int column);
/**
* Returns the item label position for all positive values in a series.
*
* @param series the series index (zero-based).
*
* @return The item label position (never {@code null}).
*/
ItemLabelPosition getSeriesPositiveItemLabelPosition(int series);
/**
* Sets the item label position for all positive values in a series and
* sends a {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param position the position ({@code null} permitted).
*/
void setSeriesPositiveItemLabelPosition(int series,
ItemLabelPosition position);
/**
* Sets the item label position for all positive values in a series and (if
* requested) sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param series the series index (zero-based).
* @param position the position ({@code null} permitted).
* @param notify notify registered listeners?
*/
void setSeriesPositiveItemLabelPosition(int series,
ItemLabelPosition position, boolean notify);
/**
* Returns the default positive item label position.
*
* @return The position (never {@code null}).
*/
ItemLabelPosition getDefaultPositiveItemLabelPosition();
/**
* Sets the default positive item label position.
*
* @param position the position ({@code null} not permitted).
*/
void setDefaultPositiveItemLabelPosition(ItemLabelPosition position);
/**
* Sets the default positive item label position and, if requested, sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param position the position ({@code null} not permitted).
* @param notify notify registered listeners?
*/
void setDefaultPositiveItemLabelPosition(ItemLabelPosition position,
boolean notify);
// NEGATIVE ITEM LABEL POSITION...
/**
* Returns the item label position for negative values. This method can be
* overridden to provide customisation of the item label position for
* individual data items.
*
* @param row the row index (zero-based).
* @param column the column (zero-based).
*
* @return The item label position (never {@code null}).
*/
ItemLabelPosition getNegativeItemLabelPosition(int row, int column);
/**
* Returns the item label position for all negative values in a series.
*
* @param series the series index (zero-based).
*
* @return The item label position (never {@code null}).
*/
ItemLabelPosition getSeriesNegativeItemLabelPosition(int series);
/**
* Sets the item label position for negative values in a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param position the position ({@code null} permitted).
*/
void setSeriesNegativeItemLabelPosition(int series,
ItemLabelPosition position);
/**
* Sets the item label position for negative values in a series and (if
* requested) sends a {@link RendererChangeEvent} to all registered
* listeners.
*
* @param series the series index (zero-based).
* @param position the position ({@code null} permitted).
* @param notify notify registered listeners?
*/
void setSeriesNegativeItemLabelPosition(int series,
ItemLabelPosition position, boolean notify);
/**
* Returns the default item label position for negative values.
*
* @return The position (never {@code null}).
*/
ItemLabelPosition getDefaultNegativeItemLabelPosition();
/**
* Sets the default item label position for negative values and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param position the position ({@code null} not permitted).
*/
void setDefaultNegativeItemLabelPosition(ItemLabelPosition position);
/**
* Sets the default negative item label position and, if requested, sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param position the position ({@code null} not permitted).
* @param notify notify registered listeners?
*/
void setDefaultNegativeItemLabelPosition(ItemLabelPosition position,
boolean notify);
// CREATE ENTITIES
/**
* Returns {@code true} if an entity should be created for an item, and
* {@code false} otherwise.
*
* @param series the series.
* @param item the item.
*
* @return A boolean.
*/
boolean getItemCreateEntity(int series, int item);
/**
* Returns {@code true} if entities should be created for a series, and
* {@code false} otherwise. This method can return {@code null} in which
* case the renderering framework will look at the default setting.
*
* @param series the series.
*
* @return A boolean.
*/
Boolean getSeriesCreateEntities(int series);
/**
* Sets a flag that specifies whether or not entities should be created for
* a series during rendering, and sends a change event to registered
* listeners.
*
* @param series the series.
* @param create the flag value ({@code null} permitted).
*/
void setSeriesCreateEntities(int series, Boolean create);
/**
* Sets a flag that specifies whether or not entities should be created for
* a series during rendering, and sends a change event to registered
* listeners.
*
* @param series the series.
* @param create the flag value ({@code null} permitted).
* @param notify send a change event?
*/
void setSeriesCreateEntities(int series, Boolean create,
boolean notify);
/**
* Returns the default value determining whether or not entities should be
* created by the renderer.
*
* @return A boolean.
*/
boolean getDefaultCreateEntities();
/**
* Sets the default value determining whether or not entities should be
* created by the renderer, and sends a change event to all registered
* listeners.
*
* @param create the flag value.
*/
void setDefaultCreateEntities(boolean create);
/**
* Sets the default value determining whether or not entities should be
* created by the renderer, and sends a change event to all registered
* listeners.
*
* @param create the flag value.
* @param notify notify listeners?
*/
void setDefaultCreateEntities(boolean create, boolean notify);
//// ANNOTATIONS //////////////////////////////////////////////////////////
/**
* Adds an annotation and sends a {@link RendererChangeEvent} to all
* registered listeners. The annotation is added to the foreground
* layer.
*
* @param annotation the annotation ({@code null} not permitted).
*/
void addAnnotation(XYAnnotation annotation);
/**
* Adds an annotation to the specified layer.
*
* @param annotation the annotation ({@code null} not permitted).
* @param layer the layer ({@code null} not permitted).
*/
void addAnnotation(XYAnnotation annotation, Layer layer);
/**
* Removes the specified annotation and sends a {@link RendererChangeEvent}
* to all registered listeners.
*
* @param annotation the annotation to remove ({@code null} not
* permitted).
*
* @return A boolean to indicate whether or not the annotation was
* successfully removed.
*/
boolean removeAnnotation(XYAnnotation annotation);
/**
* Removes all annotations and sends a {@link RendererChangeEvent}
* to all registered listeners.
*/
void removeAnnotations();
/**
* Draws all the annotations for the specified layer.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param layer the layer.
* @param info the plot rendering info.
*/
void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer,
PlotRenderingInfo info);
//// DRAWING //////////////////////////////////////////////////////////////
/**
* Initialises the renderer then returns the number of 'passes' through the
* data that the renderer will require (usually just one). This method
* will be called before the first item is rendered, giving the renderer
* an opportunity to initialise any state information it wants to maintain.
* The renderer can do nothing if it chooses.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
* @param plot the plot.
* @param dataset the dataset.
* @param info an optional info collection object to return data back to
* the caller.
*
* @return The number of passes the renderer requires.
*/
XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea,
XYPlot plot, XYDataset dataset, PlotRenderingInfo info);
/**
* Called for each item to be plotted.
*
* The {@link XYPlot} can make multiple passes through the dataset,
* depending on the value returned by the renderer's initialise() method.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the area within which the data is being rendered.
* @param info collects drawing info.
* @param plot the plot (can be used to obtain standard color
* information etc).
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param dataset the dataset.
* @param series the series index (zero-based).
* @param item the item index (zero-based).
* @param crosshairState crosshair information for the plot
* ({@code null} permitted).
* @param pass the pass index.
*/
void drawItem(Graphics2D g2, XYItemRendererState state,
Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot,
ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset,
int series, int item, CrosshairState crosshairState, int pass);
/**
* Fills a band between two values on the axis. This can be used to color
* bands between the grid lines.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the domain axis.
* @param dataArea the data area.
* @param start the start value.
* @param end the end value.
*/
void fillDomainGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
Rectangle2D dataArea, double start, double end);
/**
* Fills a band between two values on the range axis. This can be used to
* color bands between the grid lines.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the range axis.
* @param dataArea the data area.
* @param start the start value.
* @param end the end value.
*/
void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
Rectangle2D dataArea, double start, double end);
/**
* Draws a grid line against the domain axis.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the value axis.
* @param dataArea the area for plotting data.
* @param value the value.
* @param paint the paint ({@code null} not permitted).
* @param stroke the stroke ({@code null} not permitted).
*/
void drawDomainLine(Graphics2D g2, XYPlot plot, ValueAxis axis,
Rectangle2D dataArea, double value, Paint paint, Stroke stroke);
/**
* Draws a line perpendicular to the range axis.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the value axis.
* @param dataArea the area for plotting data.
* @param value the data value.
* @param paint the paint ({@code null} not permitted).
* @param stroke the stroke ({@code null} not permitted).
*/
void drawRangeLine(Graphics2D g2, XYPlot plot, ValueAxis axis,
Rectangle2D dataArea, double value, Paint paint, Stroke stroke);
/**
* Draws the specified {@code marker} against the domain axis.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the value axis.
* @param marker the marker.
* @param dataArea the axis data area.
*/
void drawDomainMarker(Graphics2D g2, XYPlot plot, ValueAxis axis,
Marker marker, Rectangle2D dataArea);
/**
* Draws a horizontal line across the chart to represent a 'range marker'.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the value axis.
* @param marker the marker line.
* @param dataArea the axis data area.
*/
void drawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis axis,
Marker marker, Rectangle2D dataArea);
}