annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java @ 1142:12abbf15f18a

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:20 +0200
parents f953c9a559d8
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1114
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1114
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1114
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1114
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: 1114
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: 1114
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: 1114
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1114
diff changeset
8
1055
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.chart;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import java.util.ArrayList;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.util.HashMap;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import java.util.List;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.util.Map;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.jfree.data.general.DatasetChangeEvent;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.jfree.data.xy.AbstractIntervalXYDataset;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import org.jfree.data.xy.IntervalXYDataset;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import org.jfree.data.statistics.HistogramType;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import org.jfree.data.statistics.HistogramBin;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import org.jfree.util.ObjectUtilities;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import org.jfree.util.PublicCloneable;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * This class extends the functionality of the internal JFreeChart class
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * <code>HistogramDataset</code>. <code>AdvancedHistogramDataset</code> takes
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 * the number of bins OR a bin width. It is mainly a copy of this class. The
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 * reason why there is no inheritance from JFreeChart's internal class is,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 * that basic attributes have private access there.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 public class AdvancedHistogramDataset
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 extends AbstractIntervalXYDataset
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 implements IntervalXYDataset, Cloneable, PublicCloneable, Serializable
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 /** A list of maps. */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 protected List list;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 /** The histogram type. */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 protected HistogramType type;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 /** The width of a single bin. */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 protected double binWidth = -1;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 /** The number of bins. */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 protected int bins = -1;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 /** The logger */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 private static Logger logger =
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 Logger.getLogger(AdvancedHistogramDataset.class);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 * Creates a new (empty) dataset with a default type of
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 * {@link HistogramType}.FREQUENCY.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 public AdvancedHistogramDataset() {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 this.list = new ArrayList();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 this.type = HistogramType.FREQUENCY;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 * Creates a new (empty) dataset with a default type of
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 * {@link HistogramType}.FREQUENCY.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public AdvancedHistogramDataset(int bins, double binWidth) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 this.list = new ArrayList();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 this.type = HistogramType.FREQUENCY;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 this.bins = bins;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 this.binWidth = binWidth;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 * Returns the histogram type.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 * @return The type (never <code>null</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 public HistogramType getType() {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 return this.type;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 * Sets the histogram type and sends a {@link DatasetChangeEvent} to all
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 * registered listeners.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 * @param type the type (<code>null</code> not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 public void setType(HistogramType type) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 if (type == null) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 throw new IllegalArgumentException("Null 'type' argument");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 this.type = type;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 notifyListeners(new DatasetChangeEvent(this, this));
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 * Adds a series to the dataset, using the specified number of bins.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 * @param key the series key (<code>null</code> not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 * @param values the values (<code>null</code> not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 public void addSeries(Comparable key, double[] values) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 double minimum = getMinimum(values);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 double maximum = getMaximum(values);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 addSeries(key, values, minimum, maximum);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 * Adds a series to the dataset. Any data value less than minimum will be
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 * assigned to the first bin, and any data value greater than maximum will
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 * be assigned to the last bin. Values falling on the boundary of
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 * adjacent bins will be assigned to the higher indexed bin.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 * @param key the series key (<code>null</code> not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 * @param values the raw observations.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 * @param bins the number of bins (must be at least 1).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 * @param minimum the lower bound of the bin range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 * @param maximum the upper bound of the bin range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 public void addSeries(Comparable key,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 double[] values,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 double minimum,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 double maximum) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 if (key == null) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 throw new IllegalArgumentException("Null 'key' argument.");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 if (values == null) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 throw new IllegalArgumentException("Null 'values' argument.");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 if (bins <= 0 && binWidth <= 0) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 throw new IllegalArgumentException(
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 "We need at least a bin width or the number of bins.");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 // There is a binWidth given to calculate the number of bins in this
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 // case
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 if (bins <= 0) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 double tmp = (maximum - minimum) / binWidth;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 bins = (int) tmp;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 bins = tmp % 1 > 0 ? bins + 1 : bins;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 double overlap = minimum + bins * binWidth - maximum;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 tmp = minimum;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 minimum -= overlap / 2;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 logger.debug("There is an overlap of " + overlap);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 logger.info("The lower bound is moved left from "
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 + tmp + " to " + minimum);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 tmp = maximum;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 maximum += overlap / 2;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 logger.info("The upper bound is moved right from "
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 + tmp + " to " + maximum);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 if (bins <= 0) {
1114
7e085bfb107b Bugfix: Histogram width results in an IllegalArgumentException (issue320).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1055
diff changeset
164 bins = 1;
1055
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 // in this case, there is a number of bins given, so we need to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 // calculate the width of a single bin
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 if (binWidth <= 0)
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 binWidth = (maximum - minimum) / bins;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 logger.info("bin width: " + binWidth);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 logger.info("number of bins: " + bins);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 double lower = minimum;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 double upper;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 List binList = new ArrayList(bins);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 for (int i = 0; i < bins; i++) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 HistogramBin bin;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 // make sure bins[bins.length]'s upper boundary ends at maximum
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 // to avoid the rounding issue. the bins[0] lower boundary is
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 // guaranteed start from min
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 if (i == bins - 1) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 bin = new HistogramBin(lower, maximum);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 else {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 upper = minimum + (i + 1) * binWidth;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 bin = new HistogramBin(lower, upper);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 lower = upper;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 binList.add(bin);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 // fill the bins
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 for (int i = 0; i < values.length; i++) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 int binIndex = bins - 1;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 if (values[i] < maximum) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 double fraction = (values[i] - minimum) / (maximum - minimum);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 if (fraction < 0.0) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 fraction = 0.0;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 binIndex = (int) (fraction * bins);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 // rounding could result in binIndex being equal to bins
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 // which will cause an IndexOutOfBoundsException - see bug
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 // report 1553088
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 if (binIndex >= bins) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 binIndex = bins - 1;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 HistogramBin bin = (HistogramBin) binList.get(binIndex);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 bin.incrementCount();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 // generic map for each series
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 Map map = new HashMap();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 map.put("key", key);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 map.put("bins", binList);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 map.put("values.length", new Integer(values.length));
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 map.put("bin width", new Double(binWidth));
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 this.list.add(map);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 * Returns the minimum value in an array of values.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 * @param values the values (<code>null</code> not permitted and
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225 * zero-length array not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 * @return The minimum value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 private double getMinimum(double[] values) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 if (values == null || values.length < 1) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 throw new IllegalArgumentException(
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 "Null or zero length 'values' argument.");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 double min = Double.MAX_VALUE;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235 for (int i = 0; i < values.length; i++) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 if (values[i] < min) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 min = values[i];
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 return min;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 * Returns the maximum value in an array of values.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 * @param values the values (<code>null</code> not permitted and
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 * zero-length array not permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 * @return The maximum value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 private double getMaximum(double[] values) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 if (values == null || values.length < 1) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 throw new IllegalArgumentException(
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 "Null or zero length 'values' argument.");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 double max = -Double.MAX_VALUE;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 for (int i = 0; i < values.length; i++) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 if (values[i] > max) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 max = values[i];
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 return max;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 * Returns the bins for a series.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 * @return A list of bins.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276 List getBins(int series) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277 Map map = (Map) this.list.get(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 return (List) map.get("bins");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 * Returns the total number of observations for a series.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 * @param series the series index.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 * @return The total.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 private int getTotal(int series) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 Map map = (Map) this.list.get(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 return ((Integer) map.get("values.length")).intValue();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
291 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294 * Returns the bin width for a series.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296 * @param series the series index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298 * @return The bin width.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
299 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
300 private double getBinWidth(int series) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
301 if (binWidth > 0)
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 return binWidth;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
303
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304 Map map = (Map) this.list.get(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 return ((Double) map.get("bin width")).doubleValue();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
308 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
309 * Returns the number of series in the dataset.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
310 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311 * @return The series count.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 public int getSeriesCount() {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 return this.list.size();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318 * Returns the key for a series.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
322 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323 * @return The series key.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
325 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
328 public Comparable getSeriesKey(int series) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 Map map = (Map) this.list.get(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330 return (Comparable) map.get("key");
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
331 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
334 * Returns the number of data items for a series.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
338 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
339 * @return The item count.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
341 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
342 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
344 public int getItemCount(int series) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
345 return getBins(series).size();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
347
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
348 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
349 * Returns the X value for a bin. This value won't be used for plotting
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
350 * histograms, since the renderer will ignore it. But other renderers can
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
351 * use it (for example, you could use the dataset to create a line
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
352 * chart).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
353 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
354 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
355 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
357 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
358 * @return The start value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
359 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
360 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
361 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
362 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
363 public Number getX(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
364 List bins = getBins(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
365 HistogramBin bin = (HistogramBin) bins.get(item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
366 double x = (bin.getStartBoundary() + bin.getEndBoundary()) / 2.;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
367 return new Double(x);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
368 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
369
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
370 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371 * Returns the y-value for a bin (calculated to take into account the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372 * histogram type).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
373 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
374 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
375 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
376 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
378 * @return The y-value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
383 public Number getY(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
384 List bins = getBins(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 HistogramBin bin = (HistogramBin) bins.get(item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 double total = getTotal(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387 double binWidth = getBinWidth(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
388
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
389 if (this.type == HistogramType.FREQUENCY) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
390 return new Double(bin.getCount());
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
391 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
392 else if (this.type == HistogramType.RELATIVE_FREQUENCY) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
393 return new Double(bin.getCount() / total);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
394 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
395 else if (this.type == HistogramType.SCALE_AREA_TO_1) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
396 return new Double(bin.getCount() / (binWidth * total));
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
397 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
398 else { // pretty sure this shouldn't ever happen
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
399 throw new IllegalStateException();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
400 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
401 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
402
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
403 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
404 * Returns the start value for a bin.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
405 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
406 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
407 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
408 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
409 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
410 * @return The start value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
411 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
412 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
413 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
414 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
415 public Number getStartX(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
416 List bins = getBins(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
417 HistogramBin bin = (HistogramBin) bins.get(item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
418 return new Double(bin.getStartBoundary());
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
419 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
420
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
421 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
422 * Returns the end value for a bin.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
423 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
424 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
425 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
426 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
427 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
428 * @return The end value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
429 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
430 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
431 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
432 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
433 public Number getEndX(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
434 List bins = getBins(series);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
435 HistogramBin bin = (HistogramBin) bins.get(item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
436 return new Double(bin.getEndBoundary());
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
437 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
438
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
439 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
440 * Returns the start y-value for a bin (which is the same as the y-value,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
441 * this method exists only to support the general form of the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
442 * {@link IntervalXYDataset} interface).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
443 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
444 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
445 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
446 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
447 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
448 * @return The y-value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
449 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
450 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
451 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
452 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
453 public Number getStartY(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
454 return getY(series, item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
455 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
456
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
457 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
458 * Returns the end y-value for a bin (which is the same as the y-value,
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
459 * this method exists only to support the general form of the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
460 * {@link IntervalXYDataset} interface).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
461 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
462 * @param series the series index (in the range <code>0</code> to
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
463 * <code>getSeriesCount() - 1</code>).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
464 * @param item the item index (zero based).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
465 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
466 * @return The Y value.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
467 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
468 * @throws IndexOutOfBoundsException if <code>series</code> is outside the
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
469 * specified range.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
470 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
471 public Number getEndY(int series, int item) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
472 return getY(series, item);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
473 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
474
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
475 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
476 * Tests this dataset for equality with an arbitrary object.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
477 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
478 * @param obj the object to test against (<code>null</code> permitted).
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
479 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
480 * @return A boolean.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
481 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
482 public boolean equals(Object obj) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
483 if (obj == this) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
484 return true;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
485 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
486 if (!(obj instanceof AdvancedHistogramDataset)) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
487 return false;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
488 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
489 AdvancedHistogramDataset that = (AdvancedHistogramDataset) obj;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
490 if (!ObjectUtilities.equal(this.type, that.type)) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
491 return false;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
492 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
493 if (!ObjectUtilities.equal(this.list, that.list)) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
494 return false;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
495 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
496 return true;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
497 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
498
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
499 /**
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
500 * Returns a clone of the dataset.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
501 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
502 * @return A clone of the dataset.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
503 *
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
504 * @throws CloneNotSupportedException if the object cannot be cloned.
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
505 */
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
506 public Object clone() throws CloneNotSupportedException {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
507 AdvancedHistogramDataset clone = (AdvancedHistogramDataset) super.clone();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
508 int seriesCount = getSeriesCount();
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
509 clone.list = new java.util.ArrayList(seriesCount);
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
510 for (int i = 0; i < seriesCount; i++) {
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
511 clone.list.add(new HashMap((Map) this.list.get(i)));
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
512 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
513 return clone;
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
514 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
515 }
bb2679624c6a Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
516 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org