annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractHistogram.java @ 1139:3a28fef65500

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:16 +0200
parents f953c9a559d8
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1107
diff changeset
8
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.chart;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.util.Locale;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.jfree.chart.ChartFactory;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.jfree.chart.ChartTheme;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.jfree.chart.JFreeChart;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
1107
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
19 import org.jfree.chart.axis.NumberAxis;
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
20 import org.jfree.chart.axis.TickUnitSource;
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
21
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import org.jfree.chart.plot.PlotOrientation;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import org.jfree.chart.plot.XYPlot;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
623
65f09139e9b3 Fixed file handle leak when writing meta data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 617
diff changeset
25 import org.jfree.chart.renderer.xy.XYBarRenderer;
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 /**
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
28 * This abstract class defines some methods to adjust chart settings after its
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
29 * creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
30 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public abstract class AbstractHistogram
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 implements Chart
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 {
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
36 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
37 * Logger used for logging with Apache log4j.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
38 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private Logger logger = Logger.getLogger(AbstractHistogram.class);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
41 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
42 * JFreeChart chart stored at this place after chart creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
43 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 protected JFreeChart chart;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
45
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
46 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
47 * Labels used for chart title, subtitle, axis description.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
48 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 protected ChartLabels labels;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
50
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
51 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
52 * Theme which is used to adjust the styling of this chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
53 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 protected ChartTheme theme;
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
55
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
56 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
57 * Raw data which should be displayed in the chart.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
58 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 protected Object[] data;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
61 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
62 * Locale object used for i18n support.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
63 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 protected Locale locale;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
67 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
68 * Constructor for creating histogram charts.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
69 *
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
70 * @param labels See {@link #labels}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
71 * @param data See {@link #data}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
72 * @param theme See {@link #theme}
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
73 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 public AbstractHistogram(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 ChartLabels labels, Object[] data, ChartTheme theme
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 ) {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 this.labels = labels;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 this.data = data;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 this.theme = theme;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
83 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
84 * @see de.intevation.gnv.chart.Chart#generateChart()
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
85 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 public JFreeChart generateChart() {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 if (chart != null)
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 return chart;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 chart = ChartFactory.createHistogram(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 labels.getTitle(),
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 labels.getDomainAxisLabel(),
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 labels.getRangeAxisLabel(),
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 null,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 PlotOrientation.VERTICAL,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 true,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 false,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 false);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 applyDatasets();
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 theme.apply(chart);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 adjustPlot();
1107
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
105 adjustDomainAxis(chart);
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
106 adjustRangeAxis(chart);
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 return chart;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
112 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
113 * Method to do some changes in plot settings.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
114 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 protected void adjustPlot() {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 XYPlot plot = (XYPlot) chart.getPlot();
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 renderer.setShadowVisible(false);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 renderer.setSeriesVisibleInLegend(0, false);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123
1107
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
124 protected void adjustDomainAxis(JFreeChart chart) {
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
125 XYPlot plot = (XYPlot) chart.getPlot();
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
126 NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
127
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
128 TickUnitSource tus = domainAxis.createStandardTickUnits(locale);
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
129 domainAxis.setStandardTickUnits(tus);
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
130 }
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
131
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
132
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
133 protected void adjustRangeAxis(JFreeChart chart) {
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
134 XYPlot plot = (XYPlot) chart.getPlot();
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
135 NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
136
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
137 TickUnitSource tus = rangeAxis.createStandardTickUnits(locale);
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
138 rangeAxis.setStandardTickUnits(tus);
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
139 }
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
140
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
141
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
142
86ca3c10523f Adjust the format of axes labels in histograms corresponding the specified locale (issue316).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 767
diff changeset
143
767
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
144 /**
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
145 * This method needs to be implemented by subclasses and should add valid
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
146 * <code>HistogramDataset</code> objects to the created chart. It is called
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
147 * by {@link #generateChart} after chart creation.
79401c871da4 Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 623
diff changeset
148 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 protected abstract void applyDatasets();
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org