001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. 006 * 007 * Project Info: http://www.jfree.org/jfreechart/index.html 008 * 009 * This library is free software; you can redistribute it and/or modify it 010 * under the terms of the GNU Lesser General Public License as published by 011 * the Free Software Foundation; either version 2.1 of the License, or 012 * (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but 015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 017 * License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this library; if not, write to the Free Software 021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 022 * USA. 023 * 024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 025 * Other names may be trademarks of their respective owners.] 026 * 027 * ---------------------- 028 * PolarItemRenderer.java 029 * ---------------------- 030 * (C) Copyright 2004-2011, by Solution Engineering, Inc. and Contributors. 031 * 032 * Original Author: Daniel Bridenbecker, Solution Engineering, Inc.; 033 * Contributor(s): David Gilbert (for Object Refinery Limited); 034 * 035 * Changes 036 * ------- 037 * 19-Jan-2004 : Version 1, contributed by DB with minor changes by DG (DG); 038 * 03-Oct-2011 : Added tooltip and URL generator support (MH); 039 * 040 */ 041 042package org.jfree.chart.renderer; 043 044import java.awt.Graphics2D; 045import java.awt.geom.Rectangle2D; 046import java.util.List; 047 048import org.jfree.chart.LegendItem; 049import org.jfree.chart.axis.ValueAxis; 050import org.jfree.chart.event.RendererChangeEvent; 051import org.jfree.chart.event.RendererChangeListener; 052import org.jfree.chart.labels.XYToolTipGenerator; 053import org.jfree.chart.plot.PlotRenderingInfo; 054import org.jfree.chart.plot.PolarPlot; 055import org.jfree.chart.urls.XYURLGenerator; 056import org.jfree.data.xy.XYDataset; 057 058/** 059 * The interface for a renderer that can be used by the {@link PolarPlot} 060 * class. 061 */ 062public interface PolarItemRenderer { 063 064 /** 065 * Plots the data for a given series. 066 * 067 * @param g2 the drawing surface. 068 * @param dataArea the data area. 069 * @param info collects plot rendering info. 070 * @param plot the plot. 071 * @param dataset the dataset. 072 * @param seriesIndex the series index. 073 */ 074 public void drawSeries(Graphics2D g2, Rectangle2D dataArea, 075 PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, 076 int seriesIndex); 077 078 /** 079 * Draw the angular gridlines - the spokes. 080 * 081 * @param g2 the drawing surface. 082 * @param plot the plot. 083 * @param ticks the ticks. 084 * @param dataArea the data area. 085 */ 086 public void drawAngularGridLines(Graphics2D g2, PolarPlot plot, 087 List ticks, Rectangle2D dataArea); 088 089 /** 090 * Draw the radial gridlines - the rings. 091 * 092 * @param g2 the drawing surface. 093 * @param plot the plot. 094 * @param radialAxis the radial axis. 095 * @param ticks the ticks. 096 * @param dataArea the data area. 097 */ 098 public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 099 ValueAxis radialAxis, List ticks, Rectangle2D dataArea); 100 101 /** 102 * Return the legend for the given series. 103 * 104 * @param series the series index. 105 * 106 * @return The legend item. 107 */ 108 public LegendItem getLegendItem(int series); 109 110 /** 111 * Returns the plot that this renderer has been assigned to. 112 * 113 * @return The plot. 114 */ 115 public PolarPlot getPlot(); 116 117 /** 118 * Sets the plot that this renderer is assigned to. This method will be 119 * called by the plot class...you do not need to call it yourself. 120 * 121 * @param plot the plot. 122 */ 123 public void setPlot(PolarPlot plot); 124 125 /** 126 * Adds a change listener. 127 * 128 * @param listener the listener. 129 */ 130 public void addChangeListener(RendererChangeListener listener); 131 132 /** 133 * Removes a change listener. 134 * 135 * @param listener the listener. 136 */ 137 public void removeChangeListener(RendererChangeListener listener); 138 139 140 //// TOOL TIP GENERATOR /////////////////////////////////////////////////// 141 142 /** 143 * Returns the tool tip generator for a data item. 144 * 145 * @param row the row index (zero based). 146 * @param column the column index (zero based). 147 * 148 * @return The generator (possibly <code>null</code>). 149 * 150 * @since 1.0.14 151 */ 152 public XYToolTipGenerator getToolTipGenerator(int row, int column); 153 154 /** 155 * Returns the tool tip generator for a series. 156 * 157 * @param series the series index (zero based). 158 * 159 * @return The generator (possibly <code>null</code>). 160 * 161 * @see #setSeriesToolTipGenerator(int, XYToolTipGenerator) 162 * 163 * @since 1.0.14 164 */ 165 public XYToolTipGenerator getSeriesToolTipGenerator(int series); 166 167 /** 168 * Sets the tool tip generator for a series and sends a 169 * {@link RendererChangeEvent} to all registered listeners. 170 * 171 * @param series the series index (zero based). 172 * @param generator the generator (<code>null</code> permitted). 173 * 174 * @see #getSeriesToolTipGenerator(int) 175 * 176 * @since 1.0.14 177 */ 178 public void setSeriesToolTipGenerator(int series, 179 XYToolTipGenerator generator); 180 181 /** 182 * Returns the base tool tip generator. 183 * 184 * @return The generator (possibly <code>null</code>). 185 * 186 * @see #setBaseToolTipGenerator(XYToolTipGenerator) 187 * 188 * @since 1.0.14 189 */ 190 public XYToolTipGenerator getBaseToolTipGenerator(); 191 192 /** 193 * Sets the base tool tip generator and sends a {@link RendererChangeEvent} 194 * to all registered listeners. 195 * 196 * @param generator the generator (<code>null</code> permitted). 197 * 198 * @see #getBaseToolTipGenerator() 199 * 200 * @since 1.0.14 201 */ 202 public void setBaseToolTipGenerator(XYToolTipGenerator generator); 203 204 205 //// URL GENERATOR //////////////////////////////////////////////////////// 206 207 /** 208 * Returns the URL generator for HTML image maps. 209 * 210 * @return The URL generator (possibly null). 211 * 212 * @since 1.0.14 213 */ 214 public XYURLGenerator getURLGenerator(); 215 216 /** 217 * Sets the URL generator for HTML image maps. 218 * 219 * @param urlGenerator the URL generator (null permitted). 220 * 221 * @since 1.0.14 222 */ 223 public void setURLGenerator(XYURLGenerator urlGenerator); 224 225}