Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java @ 8341:130160b8d245
Introduce annotations, which know to which axis they belong.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 30 Sep 2014 11:50:43 +0200 |
parents | c04c66839288 |
children | e1ff1263d79a |
comparison
equal
deleted
inserted
replaced
8340:8679875f2c09 | 8341:130160b8d245 |
---|---|
127 protected Settings settings; | 127 protected Settings settings; |
128 | 128 |
129 /** Map of datasets ("index"). */ | 129 /** Map of datasets ("index"). */ |
130 protected SortedMap<Integer, AxisDataset> datasets; | 130 protected SortedMap<Integer, AxisDataset> datasets; |
131 | 131 |
132 /** Map of annotations to add at specific Y-axis. */ | |
133 protected SortedMap<Integer, RiverAnnotation> yAnnotations; | |
134 | |
132 /** List of annotations to insert in plot. */ | 135 /** List of annotations to insert in plot. */ |
133 protected List<RiverAnnotation> annotations = new ArrayList<RiverAnnotation>(); | 136 protected List<RiverAnnotation> annotations = new ArrayList<RiverAnnotation>(); |
134 | 137 |
135 protected abstract List<AxisSection> buildYAxisSections(); | 138 protected abstract List<AxisSection> buildYAxisSections(); |
136 | 139 |
139 /** | 142 /** |
140 * Default constructor that initializes internal data structures. | 143 * Default constructor that initializes internal data structures. |
141 */ | 144 */ |
142 public ChartGenerator2() { | 145 public ChartGenerator2() { |
143 datasets = new TreeMap<Integer, AxisDataset>(); | 146 datasets = new TreeMap<Integer, AxisDataset>(); |
147 yAnnotations = new TreeMap<Integer, RiverAnnotation>(); | |
144 } | 148 } |
145 | 149 |
146 /** | 150 /** |
147 * Adds annotations to list. The given annotation will be visible. | 151 * Adds annotations to list. The given annotation will be visible. |
148 */ | 152 */ |
149 public void addAnnotations(RiverAnnotation annotation) { | 153 public void addAnnotations(RiverAnnotation annotation) { |
150 annotations.add(annotation); | 154 annotations.add(annotation); |
155 } | |
156 | |
157 public void addYAnnotation(RiverAnnotation annotation, int axisIndex) { | |
158 yAnnotations.put(axisIndex, annotation); | |
151 } | 159 } |
152 | 160 |
153 /** | 161 /** |
154 * This method needs to be implemented by concrete subclasses to create new | 162 * This method needs to be implemented by concrete subclasses to create new |
155 * instances of JFreeChart. | 163 * instances of JFreeChart. |