comparison gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractHistogram.java @ 767:79401c871da4

Added and repaired javadoc in de.intevation.gnv.chart package. gnv-artifacts/trunk@823 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Mar 2010 14:48:55 +0000
parents 65f09139e9b3
children 86ca3c10523f
comparison
equal deleted inserted replaced
766:a23ce49423d5 767:79401c871da4
12 import org.jfree.chart.plot.XYPlot; 12 import org.jfree.chart.plot.XYPlot;
13 13
14 import org.jfree.chart.renderer.xy.XYBarRenderer; 14 import org.jfree.chart.renderer.xy.XYBarRenderer;
15 15
16 /** 16 /**
17 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) 17 * This abstract class defines some methods to adjust chart settings after its
18 * creation.
19 *
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
18 */ 21 */
19 public abstract class AbstractHistogram 22 public abstract class AbstractHistogram
20 implements Chart 23 implements Chart
21 { 24 {
25 /**
26 * Logger used for logging with Apache log4j.
27 */
22 private Logger logger = Logger.getLogger(AbstractHistogram.class); 28 private Logger logger = Logger.getLogger(AbstractHistogram.class);
23 29
30 /**
31 * JFreeChart chart stored at this place after chart creation.
32 */
24 protected JFreeChart chart; 33 protected JFreeChart chart;
34
35 /**
36 * Labels used for chart title, subtitle, axis description.
37 */
25 protected ChartLabels labels; 38 protected ChartLabels labels;
39
40 /**
41 * Theme which is used to adjust the styling of this chart.
42 */
26 protected ChartTheme theme; 43 protected ChartTheme theme;
44
45 /**
46 * Raw data which should be displayed in the chart.
47 */
27 protected Object[] data; 48 protected Object[] data;
28 49
50 /**
51 * Locale object used for i18n support.
52 */
29 protected Locale locale; 53 protected Locale locale;
30 54
31 55
56 /**
57 * Constructor for creating histogram charts.
58 *
59 * @param labels See {@link #labels}
60 * @param data See {@link #data}
61 * @param theme See {@link #theme}
62 */
32 public AbstractHistogram( 63 public AbstractHistogram(
33 ChartLabels labels, Object[] data, ChartTheme theme 64 ChartLabels labels, Object[] data, ChartTheme theme
34 ) { 65 ) {
35 this.labels = labels; 66 this.labels = labels;
36 this.data = data; 67 this.data = data;
37 this.theme = theme; 68 this.theme = theme;
38 } 69 }
39 70
40 71
72 /**
73 * @see de.intevation.gnv.chart.Chart#generateChart()
74 */
41 public JFreeChart generateChart() { 75 public JFreeChart generateChart() {
42 76
43 if (chart != null) 77 if (chart != null)
44 return chart; 78 return chart;
45 79
60 94
61 return chart; 95 return chart;
62 } 96 }
63 97
64 98
99 /**
100 * Method to do some changes in plot settings.
101 */
65 protected void adjustPlot() { 102 protected void adjustPlot() {
66 XYPlot plot = (XYPlot) chart.getPlot(); 103 XYPlot plot = (XYPlot) chart.getPlot();
67 XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); 104 XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
68 105
69 renderer.setShadowVisible(false); 106 renderer.setShadowVisible(false);
70 renderer.setSeriesVisibleInLegend(0, false); 107 renderer.setSeriesVisibleInLegend(0, false);
71 } 108 }
72 109
73 110
111 /**
112 * This method needs to be implemented by subclasses and should add valid
113 * <code>HistogramDataset</code> objects to the created chart. It is called
114 * by {@link #generateChart} after chart creation.
115 */
74 protected abstract void applyDatasets(); 116 protected abstract void applyDatasets();
75 } 117 }
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : 118 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org