1. /* ===========================================================
  2. * JFreeChart : a free chart library for the Java(tm) platform
  3. * ===========================================================
  4. *
  5. * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
  6. *
  7. * Project Info: http://www.jfree.org/jfreechart/index.html
  8. *
  9. * This library is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation; either version 2.1 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  17. * License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this library; if not, write to the Free Software Foundation,
  21. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  24. * in the United States and other countries.]
  25. *
  26. * -------------------------
  27. * CategoryItemRenderer.java
  28. * -------------------------
  29. *
  30. * (C) Copyright 2001-2005, by Object Refinery Limited and Contributors.
  31. *
  32. * Original Author: David Gilbert (for Object Refinery Limited);
  33. * Contributor(s): Mark Watson (www.markwatson.com);
  34. *
  35. * $Id: CategoryItemRenderer.java,v 1.6 2005/02/23 13:02:05 mungady Exp $
  36. *
  37. * Changes
  38. * -------
  39. * 23-Oct-2001 : Version 1 (DG);
  40. * 16-Jan-2002 : Renamed HorizontalCategoryItemRenderer.java
  41. * --> CategoryItemRenderer.java (DG);
  42. * 05-Feb-2002 : Changed return type of the drawCategoryItem method from void
  43. * to Shape, as part of the tooltips implementation (DG)
  44. *
  45. * NOTE (30-May-2002) : this has subsequently been changed back
  46. * to void, tooltips are now collected along with entities in
  47. * ChartRenderingInfo (DG);
  48. *
  49. * 14-Mar-2002 : Added the initialise method, and changed all bar plots to use
  50. * this renderer (DG);
  51. * 23-May-2002 : Added ChartRenderingInfo to the initialise method (DG);
  52. * 29-May-2002 : Added the getAxisArea(Rectangle2D) method (DG);
  53. * 06-Jun-2002 : Updated Javadoc comments (DG);
  54. * 26-Jun-2002 : Added range axis to the initialise method (DG);
  55. * 24-Sep-2002 : Added getLegendItem() method (DG);
  56. * 23-Oct-2002 : Added methods to get/setToolTipGenerator (DG);
  57. * 05-Nov-2002 : Replaced references to CategoryDataset with TableDataset (DG);
  58. * 06-Nov-2002 : Added the domain axis to the drawCategoryItem method. Renamed
  59. * drawCategoryItem() --> drawItem() (DG);
  60. * 20-Nov-2002 : Changed signature of drawItem() method to reflect use of
  61. * TableDataset (DG);
  62. * 26-Nov-2002 : Replaced the isStacked() method with the getRangeType()
  63. * method (DG);
  64. * 08-Jan-2003 : Changed getSeriesCount() --> getRowCount() and
  65. * getCategoryCount() --> getColumnCount() (DG);
  66. * 09-Jan-2003 : Changed name of grid-line methods (DG);
  67. * 21-Jan-2003 : Merged TableDataset with CategoryDataset (DG);
  68. * 10-Apr-2003 : Changed CategoryDataset to KeyedValues2DDataset in
  69. * drawItem() method (DG);
  70. * 29-Apr-2003 : Eliminated Renderer interface (DG);
  71. * 02-Sep-2003 : Fix for bug 790407 (DG);
  72. * 16-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
  73. * 20-Oct-2003 : Added setOutlinePaint() method (DG);
  74. * 06-Feb-2004 : Added missing methods, and moved deprecated methods (DG);
  75. * 19-Feb-2004 : Added extra setXXXLabelsVisible() methods (DG);
  76. * 29-Apr-2004 : Changed Integer --> int in initialise() method (DG);
  77. * 18-May-2004 : Added methods for item label paint (DG);
  78. * 05-Nov-2004 : Added getPassCount() method and 'pass' parameter to drawItem()
  79. * method (DG);
  80. * 07-Jan-2005 : Renamed getRangeExtent() --> findRangeBounds (DG);
  81. * 11-Jan-2005 : Removed deprecated code in preparation for 1.0.0 release (DG);
  82. * 23-Feb-2005 : Now extends LegendItemSource (DG);
  83. *
  84. */
  85. package org.jfree.chart.renderer.category;
  86. import java.awt.Font;
  87. import java.awt.Graphics2D;
  88. import java.awt.Paint;
  89. import java.awt.Shape;
  90. import java.awt.Stroke;
  91. import java.awt.geom.Rectangle2D;
  92. import org.jfree.chart.LegendItem;
  93. import org.jfree.chart.LegendItemSource;
  94. import org.jfree.chart.axis.CategoryAxis;
  95. import org.jfree.chart.axis.ValueAxis;
  96. import org.jfree.chart.event.RendererChangeEvent;
  97. import org.jfree.chart.event.RendererChangeListener;
  98. import org.jfree.chart.labels.CategoryLabelGenerator;
  99. import org.jfree.chart.labels.CategoryToolTipGenerator;
  100. import org.jfree.chart.labels.ItemLabelPosition;
  101. import org.jfree.chart.plot.CategoryPlot;
  102. import org.jfree.chart.plot.Marker;
  103. import org.jfree.chart.plot.PlotRenderingInfo;
  104. import org.jfree.chart.urls.CategoryURLGenerator;
  105. import org.jfree.data.Range;
  106. import org.jfree.data.category.CategoryDataset;
  107. /**
  108. * A plug-in object that is used by the {@link CategoryPlot} class to display
  109. * individual data items from a {@link CategoryDataset}.
  110. * <p>
  111. * This interface defines the methods that must be provided by all renderers.
  112. * If you are implementing a custom renderer, you should consider extending the
  113. * {@link AbstractCategoryItemRenderer} class.
  114. * <p>
  115. * Most renderer attributes are defined using a "three layer" approach. When
  116. * looking up an attribute (for example, the outline paint) the renderer first
  117. * checks to see if there is a setting (in layer 0) that applies to ALL items
  118. * that the renderer draws. If there is, that setting is used, but if it is
  119. * <code>null</code> the renderer looks up the next layer, which contains
  120. * "per series" settings for the attribute (many attributes are defined on a
  121. * per series basis, so this is the layer that is most commonly used). If the
  122. * layer 1 setting is <code>null</code>, the renderer will look up the final
  123. * layer, which provides a default or "base" setting. Some attributes allow
  124. * the base setting to be <code>null</code>, while other attributes enforce
  125. * non-<code>null</code> values.
  126. */
  127. public interface CategoryItemRenderer extends LegendItemSource {
  128. /**
  129. * Returns the number of passes through the dataset required by the
  130. * renderer. Usually this will be one, but some renderers may use
  131. * a second or third pass to overlay items on top of things that were
  132. * drawn in an earlier pass.
  133. *
  134. * @return The pass count.
  135. */
  136. public int getPassCount();
  137. /**
  138. * Returns the plot that the renderer has been assigned to (where
  139. * <code>null</code> indicates that the renderer is not currently assigned
  140. * to a plot).
  141. *
  142. * @return The plot (possibly <code>null</code>).
  143. */
  144. public CategoryPlot getPlot();
  145. /**
  146. * Sets the plot that the renderer has been assigned to. This method is
  147. * usually called by the {@link CategoryPlot}, in normal usage you
  148. * shouldn't need to call this method directly.
  149. *
  150. * @param plot the plot (<code>null</code> not permitted).
  151. */
  152. public void setPlot(CategoryPlot plot);
  153. /**
  154. * Adds a change listener.
  155. *
  156. * @param listener the listener.
  157. */
  158. public void addChangeListener(RendererChangeListener listener);
  159. /**
  160. * Removes a change listener.
  161. *
  162. * @param listener the listener.
  163. */
  164. public void removeChangeListener(RendererChangeListener listener);
  165. /**
  166. * Returns the range of values the renderer requires to display all the
  167. * items from the specified dataset.
  168. *
  169. * @param dataset the dataset (<code>null</code> permitted).
  170. *
  171. * @return The range (or <code>null</code> if the dataset is
  172. * <code>null</code> or empty).
  173. */
  174. public Range findRangeBounds(CategoryDataset dataset);
  175. /**
  176. * Initialises the renderer. This method will be called before the first
  177. * item is rendered, giving the renderer an opportunity to initialise any
  178. * state information it wants to maintain. The renderer can do nothing if
  179. * it chooses.
  180. *
  181. * @param g2 the graphics device.
  182. * @param dataArea the area inside the axes.
  183. * @param plot the plot.
  184. * @param rendererIndex the renderer index.
  185. * @param info collects chart rendering information for return to caller.
  186. *
  187. * @return A state object (maintains state information relevant to one
  188. * chart drawing).
  189. */
  190. public CategoryItemRendererState initialise(Graphics2D g2,
  191. Rectangle2D dataArea,
  192. CategoryPlot plot,
  193. int rendererIndex,
  194. PlotRenderingInfo info);
  195. //// PAINT /////////////////////////////////////////////////////////////////
  196. /**
  197. * Returns the paint used to fill data items as they are drawn.
  198. *
  199. * @param row the row (or series) index (zero-based).
  200. * @param column the column (or category) index (zero-based).
  201. *
  202. * @return the paint (never <code>null</code>).
  203. */
  204. public Paint getItemPaint(int row, int column);
  205. /**
  206. * Sets the paint to be used for ALL series, and sends a
  207. * {@link RendererChangeEvent} to all registered listeners. If this is
  208. * <code>null</code>, the renderer will use the paint for the series.
  209. *
  210. * @param paint the paint (<code>null</code> permitted).
  211. */
  212. public void setPaint(Paint paint);
  213. /**
  214. * Returns the paint used to fill an item drawn by the renderer.
  215. *
  216. * @param series the series index (zero-based).
  217. *
  218. * @return the paint (never <code>null</code>).
  219. */
  220. public Paint getSeriesPaint(int series);
  221. /**
  222. * Sets the paint used for a series and sends a {@link RendererChangeEvent}
  223. * to all registered listeners.
  224. *
  225. * @param series the series index (zero-based).
  226. * @param paint the paint (<code>null</code> permitted).
  227. */
  228. public void setSeriesPaint(int series, Paint paint);
  229. /**
  230. * Returns the base paint.
  231. *
  232. * @return the base paint (never <code>null</code>).
  233. */
  234. public Paint getBasePaint();
  235. /**
  236. * Sets the base paint and sends a {@link RendererChangeEvent} to all
  237. * registered listeners.
  238. *
  239. * @param paint the paint (<code>null</code> not permitted).
  240. */
  241. public void setBasePaint(Paint paint);
  242. //// OUTLINE PAINT /////////////////////////////////////////////////////////
  243. /**
  244. * Returns the paint used to outline data items as they are drawn.
  245. *
  246. * @param row the row (or series) index (zero-based).
  247. * @param column the column (or category) index (zero-based).
  248. *
  249. * @return the paint (never <code>null</code>).
  250. */
  251. public Paint getItemOutlinePaint(int row, int column);
  252. /**
  253. * Sets the outline paint for ALL series (optional).
  254. *
  255. * @param paint the paint (<code>null</code> permitted).
  256. */
  257. public void setOutlinePaint(Paint paint);
  258. /**
  259. * Returns the paint used to outline an item drawn by the renderer.
  260. *
  261. * @param series the series (zero-based index).
  262. *
  263. * @return the paint (never <code>null</code>).
  264. */
  265. public Paint getSeriesOutlinePaint(int series);
  266. /**
  267. * Sets the paint used for a series outline and sends a
  268. * {@link RendererChangeEvent} to all registered listeners.
  269. *
  270. * @param series the series index (zero-based).
  271. * @param paint the paint (<code>null</code> permitted).
  272. */
  273. public void setSeriesOutlinePaint(int series, Paint paint);
  274. /**
  275. * Returns the base outline paint.
  276. *
  277. * @return the paint (never <code>null</code>).
  278. */
  279. public Paint getBaseOutlinePaint();
  280. /**
  281. * Sets the base outline paint and sends a {@link RendererChangeEvent} to
  282. * all registered listeners.
  283. *
  284. * @param paint the paint (<code>null</code> not permitted).
  285. */
  286. public void setBaseOutlinePaint(Paint paint);
  287. //// STROKE ////////////////////////////////////////////////////////////////
  288. /**
  289. * Returns the stroke used to draw data items.
  290. *
  291. * @param row the row (or series) index (zero-based).
  292. * @param column the column (or category) index (zero-based).
  293. *
  294. * @return the stroke (never <code>null</code>).
  295. */
  296. public Stroke getItemStroke(int row, int column);
  297. /**
  298. * Sets the stroke for ALL series and sends a {@link RendererChangeEvent}
  299. * to all registered listeners.
  300. *
  301. * @param stroke the stroke (<code>null</code> permitted).
  302. */
  303. public void setStroke(Stroke stroke);
  304. /**
  305. * Returns the stroke used to draw the items in a series.
  306. *
  307. * @param series the series (zero-based index).
  308. *
  309. * @return the stroke (never <code>null</code>).
  310. */
  311. public Stroke getSeriesStroke(int series);
  312. /**
  313. * Sets the stroke used for a series and sends a
  314. * {@link RendererChangeEvent} to all registered listeners.
  315. *
  316. * @param series the series index (zero-based).
  317. * @param stroke the stroke (<code>null</code> permitted).
  318. */
  319. public void setSeriesStroke(int series, Stroke stroke);
  320. /**
  321. * Returns the base stroke.
  322. *
  323. * @return the base stroke (never <code>null</code>).
  324. */
  325. public Stroke getBaseStroke();
  326. /**
  327. * Sets the base stroke.
  328. *
  329. * @param stroke the stroke (<code>null</code> not permitted).
  330. */
  331. public void setBaseStroke(Stroke stroke);
  332. //// OUTLINE STROKE ////////////////////////////////////////////////////////
  333. /**
  334. * Returns the stroke used to outline data items.
  335. * <p>
  336. * The default implementation passes control to the getSeriesOutlineStroke
  337. * method. You can override this method if you require different behaviour.
  338. *
  339. * @param row the row (or series) index (zero-based).
  340. * @param column the column (or category) index (zero-based).
  341. *
  342. * @return the stroke (never <code>null</code>).
  343. */
  344. public Stroke getItemOutlineStroke(int row, int column);
  345. /**
  346. * Sets the outline stroke for ALL series and sends a
  347. * {@link RendererChangeEvent} to all registered listeners.
  348. *
  349. * @param stroke the stroke (<code>null</code> permitted).
  350. */
  351. public void setOutlineStroke(Stroke stroke);
  352. /**
  353. * Returns the stroke used to outline the items in a series.
  354. *
  355. * @param series the series (zero-based index).
  356. *
  357. * @return the stroke (never <code>null</code>).
  358. */
  359. public Stroke getSeriesOutlineStroke(int series);
  360. /**
  361. * Sets the outline stroke used for a series and sends a
  362. * {@link RendererChangeEvent} to all registered listeners.
  363. *
  364. * @param series the series index (zero-based).
  365. * @param stroke the stroke (<code>null</code> permitted).
  366. */
  367. public void setSeriesOutlineStroke(int series, Stroke stroke);
  368. /**
  369. * Returns the base outline stroke.
  370. *
  371. * @return the stroke (never <code>null</code>).
  372. */
  373. public Stroke getBaseOutlineStroke();
  374. /**
  375. * Sets the base outline stroke and sends a {@link RendererChangeEvent} to
  376. * all registered listeners.
  377. *
  378. * @param stroke the stroke (<code>null</code> not permitted).
  379. */
  380. public void setBaseOutlineStroke(Stroke stroke);
  381. //// SHAPE /////////////////////////////////////////////////////////////////
  382. /**
  383. * Returns a shape used to represent a data item.
  384. *
  385. * @param row the row (or series) index (zero-based).
  386. * @param column the column (or category) index (zero-based).
  387. *
  388. * @return the shape (never <code>null</code>).
  389. */
  390. public Shape getItemShape(int row, int column);
  391. /**
  392. * Sets the shape for ALL series (optional) and sends a
  393. * {@link RendererChangeEvent} to all registered listeners.
  394. *
  395. * @param shape the shape (<code>null</code> permitted).
  396. */
  397. public void setShape(Shape shape);
  398. /**
  399. * Returns a shape used to represent the items in a series.
  400. *
  401. * @param series the series (zero-based index).
  402. *
  403. * @return the shape (never <code>null</code>).
  404. */
  405. public Shape getSeriesShape(int series);
  406. /**
  407. * Sets the shape used for a series and sends a {@link RendererChangeEvent}
  408. * to all registered listeners.
  409. *
  410. * @param series the series index (zero-based).
  411. * @param shape the shape (<code>null</code> permitted).
  412. */
  413. public void setSeriesShape(int series, Shape shape);
  414. /**
  415. * Returns the base shape.
  416. *
  417. * @return the shape (never <code>null</code>).
  418. */
  419. public Shape getBaseShape();
  420. /**
  421. * Sets the base shape and sends a {@link RendererChangeEvent} to all
  422. * registered listeners.
  423. *
  424. * @param shape the shape (<code>null</code> not permitted).
  425. */
  426. public void setBaseShape(Shape shape);
  427. // ITEM LABELS VISIBLE
  428. /**
  429. * Returns <code>true</code> if an item label is visible, and
  430. * <code>false</code> otherwise.
  431. *
  432. * @param row the row index (zero-based).
  433. * @param column the column index (zero-based).
  434. *
  435. * @return a boolean.
  436. */
  437. public boolean isItemLabelVisible(int row, int column);
  438. /**
  439. * Returns <code>true</code> if the item labels for a series are visible,
  440. * and <code>false</code> otherwise.
  441. *
  442. * @param series the series index (zero-based).
  443. *
  444. * @return a boolean.
  445. */
  446. public boolean isSeriesItemLabelsVisible(int series);
  447. /**
  448. * Sets a flag that controls whether or not the item labels for ALL series
  449. * are visible.
  450. *
  451. * @param visible the flag.
  452. */
  453. public void setItemLabelsVisible(boolean visible);
  454. /**
  455. * Sets a flag that controls whether or not the item labels for ALL series
  456. * are visible.
  457. *
  458. * @param visible the flag (<code>null</code> permitted).
  459. */
  460. public void setItemLabelsVisible(Boolean visible);
  461. /**
  462. * Sets the visibility of item labels for ALL series and, if requested,
  463. * sends a {@link RendererChangeEvent} to all registered listeners.
  464. *
  465. * @param visible a flag that controls whether or not the item labels are
  466. * visible (<code>null</code> permitted).
  467. * @param notify a flag that controls whether or not listeners are
  468. * notified.
  469. */
  470. public void setItemLabelsVisible(Boolean visible, boolean notify);
  471. /**
  472. * Sets a flag that controls the visibility of the item labels for a series.
  473. *
  474. * @param series the series index (zero-based).
  475. * @param visible the flag.
  476. */
  477. public void setSeriesItemLabelsVisible(int series, boolean visible);
  478. /**
  479. * Sets a flag that controls the visibility of the item labels for a series.
  480. *
  481. * @param series the series index (zero-based).
  482. * @param visible the flag (<code>null</code> permitted).
  483. */
  484. public void setSeriesItemLabelsVisible(int series, Boolean visible);
  485. /**
  486. * Sets the visibility of item labels for a series and, if requested, sends
  487. * a {@link RendererChangeEvent} to all registered listeners.
  488. *
  489. * @param series the series index (zero-based).
  490. * @param visible the visible flag.
  491. * @param notify a flag that controls whether or not listeners are
  492. * notified.
  493. */
  494. public void setSeriesItemLabelsVisible(int series, Boolean visible,
  495. boolean notify);
  496. /**
  497. * Returns the base setting for item label visibility.
  498. *
  499. * @return A flag (possibly <code>null</code>).
  500. */
  501. public Boolean getBaseItemLabelsVisible();
  502. /**
  503. * Sets the base flag that controls whether or not item labels are visible.
  504. *
  505. * @param visible the flag.
  506. */
  507. public void setBaseItemLabelsVisible(boolean visible);
  508. /**
  509. * Sets the base setting for item label visibility.
  510. *
  511. * @param visible the flag (<code>null</code> permitted).
  512. */
  513. public void setBaseItemLabelsVisible(Boolean visible);
  514. /**
  515. * Sets the base visibility for item labels and, if requested, sends a
  516. * {@link RendererChangeEvent} to all registered listeners.
  517. *
  518. * @param visible the visibility flag.
  519. * @param notify a flag that controls whether or not listeners are
  520. * notified.
  521. */
  522. public void setBaseItemLabelsVisible(Boolean visible, boolean notify);
  523. // LABEL GENERATOR
  524. /**
  525. * Returns the item label generator for the specified data item.
  526. *
  527. * @param series the series index (zero-based).
  528. * @param item the item index (zero-based).
  529. *
  530. * @return The generator (possibly <code>null</code>).
  531. */
  532. public CategoryLabelGenerator getLabelGenerator(int series, int item);
  533. /**
  534. * Returns the item label generator for a series.
  535. *
  536. * @param series the series index (zero-based).
  537. *
  538. * @return The label generator (possibly <code>null</code>).
  539. */
  540. public CategoryLabelGenerator getSeriesLabelGenerator(int series);
  541. /**
  542. * Sets the item label generator for ALL series and sends a
  543. * {@link RendererChangeEvent} to all registered listeners. This overrides
  544. * the per-series settings.
  545. *
  546. * @param generator the generator (<code>null</code> permitted).
  547. */
  548. public void setLabelGenerator(CategoryLabelGenerator generator);
  549. /**
  550. * Sets the item label generator for a series and sends a
  551. * {@link RendererChangeEvent} to all registered listeners.
  552. *
  553. * @param series the series index (zero-based).
  554. * @param generator the generator.
  555. */
  556. public void setSeriesLabelGenerator(int series,
  557. CategoryLabelGenerator generator);
  558. /**
  559. * Returns the base label generator.
  560. *
  561. * @return The generator (possibly <code>null</code>).
  562. */
  563. public CategoryLabelGenerator getBaseLabelGenerator();
  564. /**
  565. * Sets the base label generator and sends a {@link RendererChangeEvent}
  566. * to all registered listeners.
  567. *
  568. * @param generator the generator (<code>null</code> permitted).
  569. */
  570. public void setBaseLabelGenerator(CategoryLabelGenerator generator);
  571. // TOOL TIP GENERATOR
  572. /**
  573. * Returns the tool tip generator that should be used for the specified
  574. * item. This method looks up the generator using the "three-layer"
  575. * approach outlined in the general description of this interface.
  576. *
  577. * @param row the row index (zero-based).
  578. * @param column the column index (zero-based).
  579. *
  580. * @return The generator (possibly <code>null</code>).
  581. */
  582. public CategoryToolTipGenerator getToolTipGenerator(int row, int column);
  583. /**
  584. * Returns the tool tip generator that will be used for ALL items in the
  585. * dataset (the "layer 0" generator).
  586. *
  587. * @return A tool tip generator (possibly <code>null</code>).
  588. */
  589. public CategoryToolTipGenerator getToolTipGenerator();
  590. /**
  591. * Sets the tool tip generator for ALL series and sends a
  592. * {@link org.jfree.chart.event.RendererChangeEvent} to all registered
  593. * listeners.
  594. *
  595. * @param generator the generator (<code>null</code> permitted).
  596. */
  597. public void setToolTipGenerator(CategoryToolTipGenerator generator);
  598. /**
  599. * Returns the tool tip generator for the specified series (a "layer 1"
  600. * generator).
  601. *
  602. * @param series the series index (zero-based).
  603. *
  604. * @return The tool tip generator (possibly <code>null</code>).
  605. */
  606. public CategoryToolTipGenerator getSeriesToolTipGenerator(int series);
  607. /**
  608. * Sets the tool tip generator for a series and sends a
  609. * {@link org.jfree.chart.event.RendererChangeEvent} to all registered
  610. * listeners.
  611. *
  612. * @param series the series index (zero-based).
  613. * @param generator the generator (<code>null</code> permitted).
  614. */
  615. public void setSeriesToolTipGenerator(int series,
  616. CategoryToolTipGenerator generator);
  617. /**
  618. * Returns the base tool tip generator (the "layer 2" generator).
  619. *
  620. * @return The tool tip generator (possibly <code>null</code>).
  621. */
  622. public CategoryToolTipGenerator getBaseToolTipGenerator();
  623. /**
  624. * Sets the base tool tip generator and sends a
  625. * {@link org.jfree.chart.event.RendererChangeEvent} to all registered
  626. * listeners.
  627. *
  628. * @param generator the generator (<code>null</code> permitted).
  629. */
  630. public void setBaseToolTipGenerator(CategoryToolTipGenerator generator);
  631. //// ITEM LABEL FONT //////////////////////////////////////////////////////
  632. /**
  633. * Returns the font for an item label.
  634. *
  635. * @param row the row index (zero-based).
  636. * @param column the column index (zero-based).
  637. *
  638. * @return The font (never <code>null</code>).
  639. */
  640. public Font getItemLabelFont(int row, int column);
  641. /**
  642. * Returns the font used for all item labels. This may be
  643. * <code>null</code>, in which case the per series font settings will apply.
  644. *
  645. * @return The font (possibly <code>null</code>).
  646. */
  647. public Font getItemLabelFont();
  648. /**
  649. * Sets the item label font for ALL series and sends a
  650. * {@link RendererChangeEvent} to all registered listeners. You can set
  651. * this to <code>null</code> if you prefer to set the font on a per series
  652. * basis.
  653. *
  654. * @param font the font (<code>null</code> permitted).
  655. */
  656. public void setItemLabelFont(Font font);
  657. /**
  658. * Returns the font for all the item labels in a series.
  659. *
  660. * @param series the series index (zero-based).
  661. *
  662. * @return The font (possibly <code>null</code>).
  663. */
  664. public Font getSeriesItemLabelFont(int series);
  665. /**
  666. * Sets the item label font for a series and sends a
  667. * {@link RendererChangeEvent} to all registered listeners.
  668. *
  669. * @param series the series index (zero-based).
  670. * @param font the font (<code>null</code> permitted).
  671. */
  672. public void setSeriesItemLabelFont(int series, Font font);
  673. /**
  674. * Returns the base item label font (this is used when no other font
  675. * setting is available).
  676. *
  677. * @return The font (<code>never</code> null).
  678. */
  679. public Font getBaseItemLabelFont();
  680. /**
  681. * Sets the base item label font and sends a {@link RendererChangeEvent}
  682. * to all registered listeners.
  683. *
  684. * @param font the font (<code>null</code> not permitted).
  685. */
  686. public void setBaseItemLabelFont(Font font);
  687. //// ITEM LABEL PAINT /////////////////////////////////////////////////////
  688. /**
  689. * Returns the paint used to draw an item label.
  690. *
  691. * @param row the row index (zero based).
  692. * @param column the column index (zero based).
  693. *
  694. * @return The paint (never <code>null</code>).
  695. */
  696. public Paint getItemLabelPaint(int row, int column);
  697. /**
  698. * Returns the paint used for all item labels. This may be
  699. * <code>null</code>, in which case the per series paint settings will
  700. * apply.
  701. *
  702. * @return The paint (possibly <code>null</code>).
  703. */
  704. public Paint getItemLabelPaint();
  705. /**
  706. * Sets the item label paint for ALL series and sends a
  707. * {@link RendererChangeEvent} to all registered listeners.
  708. *
  709. * @param paint the paint (<code>null</code> permitted).
  710. */
  711. public void setItemLabelPaint(Paint paint);
  712. /**
  713. * Returns the paint used to draw the item labels for a series.
  714. *
  715. * @param series the series index (zero based).
  716. *
  717. * @return The paint (possibly <code>null<code>).
  718. */
  719. public Paint getSeriesItemLabelPaint(int series);
  720. /**
  721. * Sets the item label paint for a series and sends a
  722. * {@link RendererChangeEvent} to all registered listeners.
  723. *
  724. * @param series the series (zero based index).
  725. * @param paint the paint (<code>null</code> permitted).
  726. */
  727. public void setSeriesItemLabelPaint(int series, Paint paint);
  728. /**
  729. * Returns the base item label paint.
  730. *
  731. * @return The paint (never <code>null<code>).
  732. */
  733. public Paint getBaseItemLabelPaint();
  734. /**
  735. * Sets the base item label paint and sends a {@link RendererChangeEvent}
  736. * to all registered listeners.
  737. *
  738. * @param paint the paint (<code>null</code> not permitted).
  739. */
  740. public void setBaseItemLabelPaint(Paint paint);
  741. // POSITIVE ITEM LABEL POSITION...
  742. /**
  743. * Returns the item label position for positive values.
  744. *
  745. * @param row the row index (zero-based).
  746. * @param column the column index (zero-based).
  747. *
  748. * @return the item label position (never <code>null</code>).
  749. */
  750. public ItemLabelPosition getPositiveItemLabelPosition(int row, int column);
  751. /**
  752. * Returns the item label position for positive values in ALL series.
  753. *
  754. * @return the item label position (possibly <code>null</code>).
  755. */
  756. public ItemLabelPosition getPositiveItemLabelPosition();
  757. /**
  758. * Sets the item label position for positive values in ALL series, and
  759. * sends a {@link RendererChangeEvent} to all registered listeners. You
  760. * need to set this to <code>null</code> to expose the settings for
  761. * individual series.
  762. *
  763. * @param position the position (<code>null</code> permitted).
  764. */
  765. public void setPositiveItemLabelPosition(ItemLabelPosition position);
  766. /**
  767. * Sets the positive item label position for ALL series and (if requested)
  768. * sends a {@link RendererChangeEvent} to all registered listeners.
  769. *
  770. * @param position the position (<code>null</code> permitted).
  771. * @param notify notify registered listeners?
  772. */
  773. public void setPositiveItemLabelPosition(ItemLabelPosition position,
  774. boolean notify);
  775. /**
  776. * Returns the item label position for all positive values in a series.
  777. *
  778. * @param series the series index (zero-based).
  779. *
  780. * @return The item label position.
  781. */
  782. public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series);
  783. /**
  784. * Sets the item label position for all positive values in a series and
  785. * sends a {@link RendererChangeEvent} to all registered listeners.
  786. *
  787. * @param series the series index (zero-based).
  788. * @param position the position (<code>null</code> permitted).
  789. */
  790. public void setSeriesPositiveItemLabelPosition(int series,
  791. ItemLabelPosition position);
  792. /**
  793. * Sets the item label position for all positive values in a series and (if
  794. * requested) sends a {@link RendererChangeEvent} to all registered
  795. * listeners.
  796. *
  797. * @param series the series index (zero-based).
  798. * @param position the position (<code>null</code> permitted).
  799. * @param notify notify registered listeners?
  800. */
  801. public void setSeriesPositiveItemLabelPosition(int series,
  802. ItemLabelPosition position,
  803. boolean notify);
  804. /**
  805. * Returns the base positive item label position.
  806. *
  807. * @return The position.
  808. */
  809. public ItemLabelPosition getBasePositiveItemLabelPosition();
  810. /**
  811. * Sets the base positive item label position.
  812. *
  813. * @param position the position.
  814. */
  815. public void setBasePositiveItemLabelPosition(ItemLabelPosition position);
  816. /**
  817. * Sets the base positive item label position and, if requested, sends a
  818. * {@link RendererChangeEvent} to all registered listeners.
  819. *
  820. * @param position the position.
  821. * @param notify notify registered listeners?
  822. */
  823. public void setBasePositiveItemLabelPosition(ItemLabelPosition position,
  824. boolean notify);
  825. // NEGATIVE ITEM LABEL POSITION...
  826. /**
  827. * Returns the item label position for negative values. This method can be
  828. * overridden to provide customisation of the item label position for
  829. * individual data items.
  830. *
  831. * @param row the row index (zero-based).
  832. * @param column the column (zero-based).
  833. *
  834. * @return the item label position.
  835. */
  836. public ItemLabelPosition getNegativeItemLabelPosition(int row, int column);
  837. /**
  838. * Returns the item label position for negative values in ALL series.
  839. *
  840. * @return the item label position (possibly <code>null</code>).
  841. */
  842. public ItemLabelPosition getNegativeItemLabelPosition();
  843. /**
  844. * Sets the item label position for negative values in ALL series, and
  845. * sends a {@link RendererChangeEvent} to all registered listeners. You
  846. * need to set this to <code>null</code> to expose the settings for
  847. * individual series.
  848. *
  849. * @param position the position (<code>null</code> permitted).
  850. */
  851. public void setNegativeItemLabelPosition(ItemLabelPosition position);
  852. /**
  853. * Sets the item label position for negative values in ALL series and (if
  854. * requested) sends a {@link RendererChangeEvent} to all registered
  855. * listeners.
  856. *
  857. * @param position the position (<code>null</code> permitted).
  858. * @param notify notify registered listeners?
  859. */
  860. public void setNegativeItemLabelPosition(ItemLabelPosition position,
  861. boolean notify);
  862. /**
  863. * Returns the item label position for all negative values in a series.
  864. *
  865. * @param series the series index (zero-based).
  866. *
  867. * @return The item label position.
  868. */
  869. public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series);
  870. /**
  871. * Sets the item label position for negative values in a series and sends a
  872. * {@link RendererChangeEvent} to all registered listeners.
  873. *
  874. * @param series the series index (zero-based).
  875. * @param position the position (<code>null</code> permitted).
  876. */
  877. public void setSeriesNegativeItemLabelPosition(int series,
  878. ItemLabelPosition position);
  879. /**
  880. * Sets the item label position for negative values in a series and (if
  881. * requested) sends a {@link RendererChangeEvent} to all registered
  882. * listeners.
  883. *
  884. * @param series the series index (zero-based).
  885. * @param position the position (<code>null</code> permitted).
  886. * @param notify notify registered listeners?
  887. */
  888. public void setSeriesNegativeItemLabelPosition(int series,
  889. ItemLabelPosition position,
  890. boolean notify);
  891. /**
  892. * Returns the base item label position for negative values.
  893. *
  894. * @return The position.
  895. */
  896. public ItemLabelPosition getBaseNegativeItemLabelPosition();
  897. /**
  898. * Sets the base item label position for negative values and sends a
  899. * {@link RendererChangeEvent} to all registered listeners.
  900. *
  901. * @param position the position.
  902. */
  903. public void setBaseNegativeItemLabelPosition(ItemLabelPosition position);
  904. /**
  905. * Sets the base negative item label position and, if requested, sends a
  906. * {@link RendererChangeEvent} to all registered listeners.
  907. *
  908. * @param position the position.
  909. * @param notify notify registered listeners?
  910. */
  911. public void setBaseNegativeItemLabelPosition(ItemLabelPosition position,
  912. boolean notify);
  913. // ITEM URL GENERATOR
  914. /**
  915. * Returns the URL generator for an item.
  916. *
  917. * @param series the series index (zero-based).
  918. * @param item the item index (zero-based).
  919. *
  920. * @return The item URL generator.
  921. */
  922. public CategoryURLGenerator getItemURLGenerator(int series, int item);
  923. /**
  924. * Returns the item URL generator for a series.
  925. *
  926. * @param series the series index (zero-based).
  927. *
  928. * @return The URL generator.
  929. */
  930. public CategoryURLGenerator getSeriesItemURLGenerator(int series);
  931. /**
  932. * Sets the item URL generator for ALL series.
  933. *
  934. * @param generator the generator.
  935. */
  936. public void setItemURLGenerator(CategoryURLGenerator generator);
  937. /**
  938. * Sets the item URL generator for a series.
  939. *
  940. * @param series the series index (zero-based).
  941. * @param generator the generator.
  942. */
  943. public void setSeriesItemURLGenerator(int series,
  944. CategoryURLGenerator generator);
  945. /**
  946. * Returns the base item URL generator.
  947. *
  948. * @return The item URL generator.
  949. */
  950. public CategoryURLGenerator getBaseItemURLGenerator();
  951. /**
  952. * Sets the base item URL generator.
  953. *
  954. * @param generator the item URL generator.
  955. */
  956. public void setBaseItemURLGenerator(CategoryURLGenerator generator);
  957. /**
  958. * Returns a legend item for a series.
  959. *
  960. * @param datasetIndex the dataset index (zero-based).
  961. * @param series the series (zero-based index).
  962. *
  963. * @return The legend item (possibly <code>null</code>).
  964. */
  965. public LegendItem getLegendItem(int datasetIndex, int series);
  966. /**
  967. * Draws a background for the data area.
  968. *
  969. * @param g2 the graphics device.
  970. * @param plot the plot.
  971. * @param dataArea the data area.
  972. */
  973. public void drawBackground(Graphics2D g2,
  974. CategoryPlot plot,
  975. Rectangle2D dataArea);
  976. /**
  977. * Draws an outline for the data area.
  978. *
  979. * @param g2 the graphics device.
  980. * @param plot the plot.
  981. * @param dataArea the data area.
  982. */
  983. public void drawOutline(Graphics2D g2,
  984. CategoryPlot plot,
  985. Rectangle2D dataArea);
  986. /**
  987. * Draws a single data item.
  988. *
  989. * @param g2 the graphics device.
  990. * @param state state information for one chart.
  991. * @param dataArea the data plot area.
  992. * @param plot the plot.
  993. * @param domainAxis the domain axis.
  994. * @param rangeAxis the range axis.
  995. * @param dataset the data.
  996. * @param row the row index (zero-based).
  997. * @param column the column index (zero-based).
  998. * @param pass the pass index.
  999. */
  1000. public void drawItem(Graphics2D g2,
  1001. CategoryItemRendererState state,
  1002. Rectangle2D dataArea,
  1003. CategoryPlot plot,
  1004. CategoryAxis domainAxis,
  1005. ValueAxis rangeAxis,
  1006. CategoryDataset dataset,
  1007. int row,
  1008. int column,
  1009. int pass);
  1010. /**
  1011. * Draws a grid line against the domain axis.
  1012. *
  1013. * @param g2 the graphics device.
  1014. * @param plot the plot.
  1015. * @param dataArea the area for plotting data (not yet adjusted for any
  1016. * 3D effect).
  1017. * @param value the value.
  1018. */
  1019. public void drawDomainGridline(Graphics2D g2,
  1020. CategoryPlot plot,
  1021. Rectangle2D dataArea,
  1022. double value);
  1023. /**
  1024. * Draws a grid line against the range axis.
  1025. *
  1026. * @param g2 the graphics device.
  1027. * @param plot the plot.
  1028. * @param axis the value axis.
  1029. * @param dataArea the area for plotting data (not yet adjusted for any
  1030. * 3D effect).
  1031. * @param value the value.
  1032. */
  1033. public void drawRangeGridline(Graphics2D g2,
  1034. CategoryPlot plot,
  1035. ValueAxis axis,
  1036. Rectangle2D dataArea,
  1037. double value);
  1038. /**
  1039. * Draws a line (or some other marker) to indicate a particular value on
  1040. * the range axis.
  1041. *
  1042. * @param g2 the graphics device.
  1043. * @param plot the plot.
  1044. * @param axis the value axis.
  1045. * @param marker the marker.
  1046. * @param dataArea the area for plotting data (not including 3D effect).
  1047. */
  1048. public void drawRangeMarker(Graphics2D g2,
  1049. CategoryPlot plot,
  1050. ValueAxis axis,
  1051. Marker marker,
  1052. Rectangle2D dataArea);
  1053. }