All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jfree.chart.renderer.xy.XYItemRenderer Maven / Gradle / Ivy

Go to download

JFreeChart is a class library, written in Java, for generating charts. Utilising the Java2D APIs, it currently supports bar charts, pie charts, line charts, XY-plots and time series plots.

There is a newer version: 1.5.5
Show newest version
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2013, by Object Refinery Limited 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-2011, by Object Refinery Limited and Contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   Mark Watson (www.markwatson.com);
 *                   Sylvain Vieujot;
 *                   Focus Computer Services Limited;
 *                   Richard Atkinson;
 *
 * Changes
 * -------
 * 19-Oct-2001 : Version 1, based on code by Mark Watson (DG);
 * 22-Oct-2001 : Renamed DataSource.java --> Dataset.java etc. (DG);
 * 13-Dec-2001 : Changed return type of drawItem from void --> Shape.  The area
 *               returned can be used as the tooltip region.
 * 23-Jan-2002 : Added DrawInfo parameter to drawItem() method (DG);
 * 28-Mar-2002 : Added a property change listener mechanism.  Now renderers do
 *               not have to be immutable (DG);
 * 04-Apr-2002 : Added the initialise() method (DG);
 * 09-Apr-2002 : Removed the translated zero from the drawItem method, it can
 *               be calculated inside the initialise method if it is required.
 *               Added a new getToolTipGenerator() method.  Changed the return
 *               type for drawItem() to void (DG);
 * 24-May-2002 : Added ChartRenderingInfo the initialise method API (DG);
 * 25-Jun-2002 : Removed redundant import (DG);
 * 20-Aug-2002 : Added get/setURLGenerator methods to interface (DG);
 * 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);
 * 18-Nov-2002 : Added methods for drawing grid lines (DG);
 * 17-Jan-2003 : Moved plot classes into a separate package (DG);
 * 27-Jan-2003 : Added shape lookup table (DG);
 * 05-Jun-2003 : Added domain and range grid bands (sponsored by Focus Computer
 *               Services Ltd) (DG);
 * 27-Jul-2003 : Added getRangeType() to support stacked XY area charts (RA);
 * 16-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
 * 25-Feb-2004 : Replaced CrosshairInfo with CrosshairState.  Renamed
 *               XYToolTipGenerator --> XYItemLabelGenerator (DG);
 * 26-Feb-2004 : Added lots of new methods (DG);
 * 30-Apr-2004 : Added getRangeExtent() method (DG);
 * 06-May-2004 : Added methods for controlling item label visibility (DG);
 * 13-May-2004 : Removed property change listener mechanism (DG);
 * 18-May-2004 : Added item label font and paint methods (DG);
 * 10-Sep-2004 : Removed redundant getRangeType() method (DG);
 * 06-Oct-2004 : Replaced getRangeExtent() with findRangeBounds() and added
 *               findDomainBounds (DG);
 * 23-Nov-2004 : Changed drawRangeGridLine() --> drawRangeLine() (DG);
 * 07-Jan-2005 : Removed deprecated method (DG);
 * 24-Feb-2005 : Now extends LegendItemSource (DG);
 * 20-Apr-2005 : Renamed XYLabelGenerator --> XYItemLabelGenerator (DG);
 * ------------- JFREECHART 1.0.x ---------------------------------------------
 * 19-Apr-2007 : Deprecated seriesVisible and seriesVisibleInLegend flags (DG);
 * 20-Apr-2007 : Deprecated paint, fillPaint, outlinePaint, stroke,
 *               outlineStroke, shape, itemLabelsVisible, itemLabelFont,
 *               itemLabelPaint, positiveItemLabelPosition,
 *               negativeItemLabelPosition and createEntities override
 *               fields (DG);
 *
 */

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.urls.XYURLGenerator;
import org.jfree.data.Range;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.Layer;

/**
 * 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 PublicCloneable interfaces. */ public interface XYItemRenderer extends LegendItemSource { /** * Returns the plot that this renderer has been assigned to. * * @return The plot. */ public 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. */ public void setPlot(XYPlot plot); /** * Returns the number of passes through the data required by the renderer. * * @return The pass count. */ public int getPassCount(); /** * Returns the lower and upper bounds (range) of the x-values in the * specified dataset. * * @param dataset the dataset (null permitted). * * @return The range. */ public 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 (null permitted). * * @return The range (or null if the dataset is * null or empty). */ public Range findRangeBounds(XYDataset dataset); /** * Add a renderer change listener. * * @param listener the listener. * * @see #removeChangeListener(RendererChangeListener) */ public void addChangeListener(RendererChangeListener listener); /** * Removes a change listener. * * @param listener the listener. * * @see #addChangeListener(RendererChangeListener) */ public 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. */ public 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. */ public 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 null). * * @see #setSeriesVisible(int, Boolean) */ public 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 (null permitted). * * @see #getSeriesVisible(int) */ public 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 (null permitted). * @param notify notify listeners? * * @see #getSeriesVisible(int) */ public void setSeriesVisible(int series, Boolean visible, boolean notify); /** * Returns the base visibility for all series. * * @return The base visibility. * * @see #setBaseSeriesVisible(boolean) */ public boolean getBaseSeriesVisible(); /** * Sets the base visibility and sends a {@link RendererChangeEvent} to all * registered listeners. * * @param visible the flag. * * @see #getBaseSeriesVisible() */ public void setBaseSeriesVisible(boolean visible); /** * Sets the base visibility and, if requested, sends * a {@link RendererChangeEvent} to all registered listeners. * * @param visible the visibility. * @param notify notify listeners? * * @see #getBaseSeriesVisible() */ public void setBaseSeriesVisible(boolean visible, boolean notify); // SERIES VISIBLE IN LEGEND (not yet respected by all renderers) /** * Returns true if the series should be shown in the legend, * and false otherwise. * * @param series the series index. * * @return A boolean. */ public 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 null). * * @see #setSeriesVisibleInLegend(int, Boolean) */ public 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 (null permitted). * * @see #getSeriesVisibleInLegend(int) */ public 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 (null permitted). * @param notify notify listeners? * * @see #getSeriesVisibleInLegend(int) */ public void setSeriesVisibleInLegend(int series, Boolean visible, boolean notify); /** * Returns the base visibility in the legend for all series. * * @return The base visibility. * * @see #setBaseSeriesVisibleInLegend(boolean) */ public boolean getBaseSeriesVisibleInLegend(); /** * Sets the base visibility in the legend and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param visible the flag. * * @see #getBaseSeriesVisibleInLegend() */ public void setBaseSeriesVisibleInLegend(boolean visible); /** * Sets the base visibility in the legend and, if requested, sends * a {@link RendererChangeEvent} to all registered listeners. * * @param visible the visibility. * @param notify notify listeners? * * @see #getBaseSeriesVisibleInLegend() */ public void setBaseSeriesVisibleInLegend(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 null). */ public 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 null). * * @see #setSeriesPaint(int, Paint) */ public 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 (null permitted). * * @see #getSeriesPaint(int) */ public void setSeriesPaint(int series, Paint paint); // FIXME: add setSeriesPaint(int, Paint, boolean)? /** * Returns the base (or default) paint. * * @return The base paint (never null). * * @see #setBasePaint(Paint) */ public Paint getBasePaint(); /** * Sets the base paint and sends a {@link RendererChangeEvent} to all * registered listeners. * * @param paint the paint (null not permitted). * * @see #getBasePaint() */ public void setBasePaint(Paint paint); // FIXME: add setBasePaint(int, Paint, boolean)? // // 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 null). // */ // public 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 null). // */ // public 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 (null permitted). // */ // public void setSeriesFillPaint(int series, Paint paint); // // // FIXME: add setSeriesFillPaint(int, Paint, boolean)? // // /** // * Returns the base paint. // * // * @return The base paint (never null). // */ // public Paint getBaseFillPaint(); // // /** // * Sets the base paint and sends a {@link RendererChangeEvent} to all // * registered listeners. // * // * @param paint the paint (null not permitted). // */ // public void setBaseFillPaint(Paint paint); // // // FIXME: add setBaseFillPaint(int, Paint, boolean)? //// 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 null). */ public 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 null). * * @see #setSeriesOutlinePaint(int, Paint) */ public 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 (null permitted). * * @see #getSeriesOutlinePaint(int) */ public void setSeriesOutlinePaint(int series, Paint paint); // FIXME: add setSeriesOutlinePaint(int, Paint, boolean)? /** * Returns the base (or default) outline paint. * * @return The paint (never null). * * @see #setBaseOutlinePaint(Paint) */ public Paint getBaseOutlinePaint(); /** * Sets the base outline paint and sends a {@link RendererChangeEvent} to * all registered listeners. * * @param paint the paint (null not permitted). * * @see #getBaseOutlinePaint() */ public void setBaseOutlinePaint(Paint paint); // FIXME: add setBaseOutlinePaint(Paint, boolean)? //// 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 null). */ public 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 null). * * @see #setSeriesStroke(int, Stroke) */ public 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 (null permitted). * * @see #getSeriesStroke(int) */ public void setSeriesStroke(int series, Stroke stroke); // FIXME: add setSeriesStroke(int, Stroke, boolean) ? /** * Returns the base (or default) stroke. * * @return The base stroke (never null). * * @see #setBaseStroke(Stroke) */ public Stroke getBaseStroke(); /** * Sets the base stroke and sends a {@link RendererChangeEvent} to all * registered listeners. * * @param stroke the stroke (null not permitted). * * @see #getBaseStroke() */ public void setBaseStroke(Stroke stroke); // FIXME: add setBaseStroke(Stroke, boolean) ? //// 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 null). */ public 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 null). * * @see #setSeriesOutlineStroke(int, Stroke) */ public 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 (null permitted). * * @see #getSeriesOutlineStroke(int) */ public void setSeriesOutlineStroke(int series, Stroke stroke); // FIXME: add setSeriesOutlineStroke(int, Stroke, boolean) ? /** * Returns the base outline stroke. * * @return The stroke (never null). * * @see #setBaseOutlineStroke(Stroke) */ public Stroke getBaseOutlineStroke(); /** * Sets the base outline stroke and sends a {@link RendererChangeEvent} to * all registered listeners. * * @param stroke the stroke (null not permitted). * * @see #getBaseOutlineStroke() */ public void setBaseOutlineStroke(Stroke stroke); // FIXME: add setBaseOutlineStroke(Stroke, boolean) ? //// 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 null). */ public 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 null). * * @see #setSeriesShape(int, Shape) */ public 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 (null permitted). * * @see #getSeriesShape(int) */ public void setSeriesShape(int series, Shape shape); // FIXME: add setSeriesShape(int, Shape, boolean) ? /** * Returns the base shape. * * @return The shape (never null). * * @see #setBaseShape(Shape) */ public Shape getBaseShape(); /** * Sets the base shape and sends a {@link RendererChangeEvent} to all * registered listeners. * * @param shape the shape (null not permitted). * * @see #getBaseShape() */ public void setBaseShape(Shape shape); // FIXME: add setBaseShape(Shape, boolean) ? //// 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 null). */ public LegendItem getLegendItem(int datasetIndex, int series); //// LEGEND ITEM LABEL GENERATOR ////////////////////////////////////////// /** * Returns the legend item label generator. * * @return The legend item label generator (never null). * * @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator) */ public XYSeriesLabelGenerator getLegendItemLabelGenerator(); /** * Sets the legend item label generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (null not permitted). */ public 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 null). */ public 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 null). * * @see #setSeriesToolTipGenerator(int, XYToolTipGenerator) */ public 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 (null permitted). * * @see #getSeriesToolTipGenerator(int) */ public void setSeriesToolTipGenerator(int series, XYToolTipGenerator generator); /** * Returns the base tool tip generator. * * @return The generator (possibly null). * * @see #setBaseToolTipGenerator(XYToolTipGenerator) */ public XYToolTipGenerator getBaseToolTipGenerator(); /** * Sets the base tool tip generator and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param generator the generator (null permitted). * * @see #getBaseToolTipGenerator() */ public void setBaseToolTipGenerator(XYToolTipGenerator generator); //// URL GENERATOR //////////////////////////////////////////////////////// /** * Returns the URL generator for HTML image maps. * * @return The URL generator (possibly null). */ public XYURLGenerator getURLGenerator(); /** * Sets the URL generator for HTML image maps. * * @param urlGenerator the URL generator (null permitted). */ public void setURLGenerator(XYURLGenerator urlGenerator); //// ITEM LABELS VISIBLE ////////////////////////////////////////////////// /** * Returns true if an item label is visible, and * false otherwise. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return A boolean. */ public boolean isItemLabelVisible(int row, int column); /** * Returns true if the item labels for a series are visible, * and false otherwise. * * @param series the series index (zero-based). * * @return A boolean. */ public 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) */ public 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 (null permitted). * * @see #isSeriesItemLabelsVisible(int) */ public 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) */ public void setSeriesItemLabelsVisible(int series, Boolean visible, boolean notify); /** * Returns the base setting for item label visibility. * * @return A flag (possibly null). * * @see #setBaseItemLabelsVisible(boolean) */ public Boolean getBaseItemLabelsVisible(); /** * Sets the base flag that controls whether or not item labels are visible. * * @param visible the flag. * * @see #getBaseItemLabelsVisible() */ public void setBaseItemLabelsVisible(boolean visible); /** * Sets the base setting for item label visibility. * * @param visible the flag (null permitted). * * @see #getBaseItemLabelsVisible() */ public void setBaseItemLabelsVisible(Boolean visible); /** * Sets the base 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 #getBaseItemLabelsVisible() */ public void setBaseItemLabelsVisible(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 null). */ public 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 null). * * @see #setSeriesItemLabelGenerator(int, XYItemLabelGenerator) */ public 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 (null permitted). * * @see #getSeriesItemLabelGenerator(int) */ public void setSeriesItemLabelGenerator(int series, XYItemLabelGenerator generator); // FIXME: /** * Returns the base item label generator. * * @return The generator (possibly null). * * @see #setBaseItemLabelGenerator(XYItemLabelGenerator) */ public XYItemLabelGenerator getBaseItemLabelGenerator(); /** * Sets the base item label generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (null permitted). * * @see #getBaseItemLabelGenerator() */ public void setBaseItemLabelGenerator(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 null). */ public 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 null). */ public 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 (null permitted). * * @see #getSeriesItemLabelFont(int) */ public void setSeriesItemLabelFont(int series, Font font); /** * Returns the base item label font (this is used when no other font * setting is available). * * @return The font (never null). * * @see #setBaseItemLabelFont(Font) */ public Font getBaseItemLabelFont(); /** * Sets the base item label font and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param font the font (null not permitted). * * @see #getBaseItemLabelFont() */ public void setBaseItemLabelFont(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 null). */ public 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 null). * * @see #setSeriesItemLabelPaint(int, Paint) */ public 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 (null permitted). * * @see #getSeriesItemLabelPaint(int) */ public void setSeriesItemLabelPaint(int series, Paint paint); /** * Returns the base item label paint. * * @return The paint (never null). */ public Paint getBaseItemLabelPaint(); /** * Sets the base item label paint and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param paint the paint (null not permitted). */ public void setBaseItemLabelPaint(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 null). */ public 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 null). */ public 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 (null permitted). */ public 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 (null permitted). * @param notify notify registered listeners? */ public void setSeriesPositiveItemLabelPosition(int series, ItemLabelPosition position, boolean notify); /** * Returns the base positive item label position. * * @return The position (never null). */ public ItemLabelPosition getBasePositiveItemLabelPosition(); /** * Sets the base positive item label position. * * @param position the position (null not permitted). */ public void setBasePositiveItemLabelPosition(ItemLabelPosition position); /** * Sets the base positive item label position and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (null not permitted). * @param notify notify registered listeners? */ public void setBasePositiveItemLabelPosition(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 null). */ public 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 null). */ public 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 (null permitted). */ public 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 (null permitted). * @param notify notify registered listeners? */ public void setSeriesNegativeItemLabelPosition(int series, ItemLabelPosition position, boolean notify); /** * Returns the base item label position for negative values. * * @return The position (never null). */ public ItemLabelPosition getBaseNegativeItemLabelPosition(); /** * Sets the base item label position for negative values and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (null not permitted). */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position); /** * Sets the base negative item label position and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (null not permitted). * @param notify notify registered listeners? */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, boolean notify); // CREATE ENTITIES // FIXME: these methods should be defined // public boolean getItemCreateEntity(int series, int item); // // public Boolean getSeriesCreateEntities(int series); // // public void setSeriesCreateEntities(int series, Boolean create); // // public void setSeriesCreateEntities(int series, Boolean create, // boolean notify); // // public boolean getBaseCreateEntities(); // // public void setBaseCreateEntities(boolean create); // // public void setBaseCreateEntities(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 (null not permitted). */ public void addAnnotation(XYAnnotation annotation); /** * Adds an annotation to the specified layer. * * @param annotation the annotation (null not permitted). * @param layer the layer (null not permitted). */ public 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 (null not * permitted). * * @return A boolean to indicate whether or not the annotation was * successfully removed. */ public boolean removeAnnotation(XYAnnotation annotation); /** * Removes all annotations and sends a {@link RendererChangeEvent} * to all registered listeners. */ public 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. */ public 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. */ public 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 * (null permitted). * @param pass the pass index. */ public 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. */ public 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. */ public 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 (not yet adjusted for any * 3D effect). * @param value the value. */ public void drawDomainGridLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value); /** * 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 (null not permitted). * @param stroke the stroke (null not permitted). */ public void drawRangeLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke); /** * Draws the specified 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. */ public 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. */ public void drawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis axis, Marker marker, Rectangle2D dataArea); // DEPRECATED METHODS /** * Returns the flag that controls the visibility of ALL series. This flag * overrides the per series and default settings - you must set it to * null if you want the other settings to apply. * * @return The flag (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesVisible(int)} and * {@link #getBaseSeriesVisible()}. */ public Boolean getSeriesVisible(); /** * Sets the flag that controls the visibility of ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. This flag * overrides the per series and default settings - you must set it to * null if you want the other settings to apply. * * @param visible the flag (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesVisible(int, Boolean)} * and {@link #setBaseSeriesVisible(boolean)}. */ public void setSeriesVisible(Boolean visible); /** * Sets the flag that controls the visibility of ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. This flag * overrides the per series and default settings - you must set it to * null if you want the other settings to apply. * * @param visible the flag (null permitted). * @param notify notify listeners? * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesVisible(int, Boolean, * boolean)} and {@link #setBaseSeriesVisible(boolean, boolean)}. */ public void setSeriesVisible(Boolean visible, boolean notify); /** * Returns the flag that controls the visibility of ALL series in the * legend. This flag overrides the per series and default settings - you * must set it to null if you want the other settings to * apply. * * @return The flag (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesVisibleInLegend(int)} * and {@link #getBaseSeriesVisibleInLegend()}. */ public Boolean getSeriesVisibleInLegend(); /** * Sets the flag that controls the visibility of ALL series in the legend * and sends a {@link RendererChangeEvent} to all registered listeners. * This flag overrides the per series and default settings - you must set * it to null if you want the other settings to apply. * * @param visible the flag (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesVisibleInLegend(int, * Boolean)} and {@link #setBaseSeriesVisibleInLegend(boolean)}. */ public void setSeriesVisibleInLegend(Boolean visible); /** * Sets the flag that controls the visibility of ALL series in the legend * and sends a {@link RendererChangeEvent} to all registered listeners. * This flag overrides the per series and default settings - you must set * it to null if you want the other settings to apply. * * @param visible the flag (null permitted). * @param notify notify listeners? * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesVisibleInLegend(int, * Boolean, boolean)} and {@link #setBaseSeriesVisibleInLegend(boolean, * boolean)}. */ public void setSeriesVisibleInLegend(Boolean visible, boolean notify); /** * Sets the paint to be used for ALL series, and sends a * {@link RendererChangeEvent} to all registered listeners. If this is * null, the renderer will use the paint for the series. * * @param paint the paint (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesPaint(int, Paint)} and * {@link #setBasePaint(Paint)}. */ public void setPaint(Paint paint); /** * Sets the outline paint for ALL series (optional). * * @param paint the paint (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesOutlinePaint(int, * Paint)} and {@link #setBaseOutlinePaint(Paint)}. */ public void setOutlinePaint(Paint paint); /** * Sets the stroke for ALL series and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param stroke the stroke (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesStroke(int, Stroke)} * and {@link #setBaseStroke(Stroke)}. */ public void setStroke(Stroke stroke); /** * Sets the outline stroke for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param stroke the stroke (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesOutlineStroke(int, * Stroke)} and {@link #setBaseOutlineStroke(Stroke)}. */ public void setOutlineStroke(Stroke stroke); /** * Sets the shape for ALL series (optional) and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param shape the shape (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesShape(int, Shape)} and * {@link #setBaseShape(Shape)}. */ public void setShape(Shape shape); /** * Sets a flag that controls whether or not the item labels for ALL series * are visible. * * @param visible the flag. * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int, * Boolean)} and {@link #setBaseItemLabelsVisible(boolean)}. */ public void setItemLabelsVisible(boolean visible); /** * Sets a flag that controls whether or not the item labels for ALL series * are visible. * * @param visible the flag (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int, * Boolean)} and {@link #setBaseItemLabelsVisible(boolean)}. */ public void setItemLabelsVisible(Boolean visible); /** * Sets the visibility of item labels for ALL series and, if requested, * sends a {@link RendererChangeEvent} to all registered listeners. * * @param visible a flag that controls whether or not the item labels are * visible (null permitted). * @param notify a flag that controls whether or not listeners are * notified. * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int, * Boolean, boolean)} and {@link #setBaseItemLabelsVisible(Boolean, * boolean)}. */ public void setItemLabelsVisible(Boolean visible, boolean notify); /** * Sets the item label generator for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (null permitted). * * @deprecated As of version 1.0.6, this override setting should not be * used. You can use the base setting instead * ({@link #setBaseItemLabelGenerator(XYItemLabelGenerator)}). */ public void setItemLabelGenerator(XYItemLabelGenerator generator); /** * Sets the tool tip generator for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (null permitted). * * @deprecated As of version 1.0.6, this override setting should not be * used. You can use the base setting instead * ({@link #setBaseToolTipGenerator(XYToolTipGenerator)}). */ public void setToolTipGenerator(XYToolTipGenerator generator); /** * Returns the font used for all item labels. This may be * null, in which case the per series font settings will apply. * * @return The font (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesItemLabelFont(int)} and * {@link #getBaseItemLabelFont()}. */ public Font getItemLabelFont(); /** * Sets the item label font for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. You can set * this to null if you prefer to set the font on a per series * basis. * * @param font the font (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelFont(int, * Font)} and {@link #setBaseItemLabelFont(Font)}. */ public void setItemLabelFont(Font font); /** * Returns the paint used for all item labels. This may be * null, in which case the per series paint settings will * apply. * * @return The paint (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesItemLabelPaint(int)} * and {@link #getBaseItemLabelPaint()}. */ public Paint getItemLabelPaint(); /** * Sets the item label paint for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param paint the paint (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelPaint(int, * Paint)} and {@link #setBaseItemLabelPaint(Paint)}. */ public void setItemLabelPaint(Paint paint); /** * Returns the item label position for positive values in ALL series. * * @return The item label position (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #getSeriesPositiveItemLabelPosition(int)} * and {@link #getBasePositiveItemLabelPosition()}. */ public ItemLabelPosition getPositiveItemLabelPosition(); /** * Sets the item label position for positive values in ALL series, and * sends a {@link RendererChangeEvent} to all registered listeners. You * need to set this to null to expose the settings for * individual series. * * @param position the position (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition)} * and {@link #setBasePositiveItemLabelPosition(ItemLabelPosition)}. */ public void setPositiveItemLabelPosition(ItemLabelPosition position); /** * Sets the positive item label position for ALL series and (if requested) * sends a {@link RendererChangeEvent} to all registered listeners. * * @param position the position (null permitted). * @param notify notify registered listeners? * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition, * boolean)} and {@link #setBasePositiveItemLabelPosition( * ItemLabelPosition, boolean)}. */ public void setPositiveItemLabelPosition(ItemLabelPosition position, boolean notify); /** * Returns the item label position for negative values in ALL series. * * @return The item label position (possibly null). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #getSeriesNegativeItemLabelPosition(int)} * and {@link #getBaseNegativeItemLabelPosition()}. */ public ItemLabelPosition getNegativeItemLabelPosition(); /** * Sets the item label position for negative values in ALL series, and * sends a {@link RendererChangeEvent} to all registered listeners. You * need to set this to null to expose the settings for * individual series. * * @param position the position (null permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition)} * and {@link #setBaseNegativeItemLabelPosition(ItemLabelPosition)}. */ public void setNegativeItemLabelPosition(ItemLabelPosition position); /** * Sets the item label position for negative values in ALL series and (if * requested) sends a {@link RendererChangeEvent} to all registered * listeners. * * @param position the position (null permitted). * @param notify notify registered listeners? * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on * {@link #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition, * boolean)} and {@link #setBaseNegativeItemLabelPosition( * ItemLabelPosition, boolean)}. */ public void setNegativeItemLabelPosition(ItemLabelPosition position, boolean notify); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy