comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3616:d4751be54745

Add rather faked image annotations to chart, if property is set accordingly. flys-artifacts/trunk@5282 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 28 Aug 2012 13:21:38 +0000
parents 45af081061e7
children 05deafdcbf39
comparison
equal deleted inserted replaced
3615:f84854eba0b3 3616:d4751be54745
9 import de.intevation.flys.jfree.StyledAreaSeriesCollection; 9 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
10 import de.intevation.flys.jfree.StyledXYSeries; 10 import de.intevation.flys.jfree.StyledXYSeries;
11 11
12 import java.awt.Color; 12 import java.awt.Color;
13 import java.awt.Font; 13 import java.awt.Font;
14 import javax.swing.ImageIcon;
14 15
15 import java.text.NumberFormat; 16 import java.text.NumberFormat;
16 17
17 import java.util.ArrayList; 18 import java.util.ArrayList;
18 import java.util.HashMap; 19 import java.util.HashMap;
23 24
24 import org.jfree.chart.ChartFactory; 25 import org.jfree.chart.ChartFactory;
25 import org.jfree.chart.JFreeChart; 26 import org.jfree.chart.JFreeChart;
26 import org.jfree.chart.LegendItem; 27 import org.jfree.chart.LegendItem;
27 28
29 import org.jfree.chart.annotations.XYAnnotation;
30 import org.jfree.chart.annotations.XYImageAnnotation;
28 import org.jfree.chart.annotations.XYTextAnnotation; 31 import org.jfree.chart.annotations.XYTextAnnotation;
29 32
30 import org.jfree.chart.axis.NumberAxis; 33 import org.jfree.chart.axis.NumberAxis;
31 import org.jfree.chart.axis.ValueAxis; 34 import org.jfree.chart.axis.ValueAxis;
32 35
238 //debugAxis(plot); 241 //debugAxis(plot);
239 242
240 // These have to go after the autozoom. 243 // These have to go after the autozoom.
241 addAnnotationsToRenderer(plot); 244 addAnnotationsToRenderer(plot);
242 245
246 // Add a logo (maybe).
247 addLogo(plot);
248
243 aggregateLegendEntries(plot); 249 aggregateLegendEntries(plot);
244 250
245 return chart; 251 return chart;
252 }
253
254
255 /** Add a logo as background annotation to plot. */
256 protected void addLogo(XYPlot plot) {
257 String logo = showLogo();
258 if (logo == null) {
259 logger.debug("No logo to show chosen");
260 return;
261 }
262
263 ImageIcon imageIcon = null;
264 // TODO: Which logo?
265 if (logo.equals("Intevation")) {
266 imageIcon = new ImageIcon("/home/felix/Downloads/intevation_logo_120.png");
267 }
268 else {
269 imageIcon = new ImageIcon("/home/felix/Downloads/bfg_logo.gif");
270 }
271
272 // TODO placement should be decided by from other properties.
273 XYAnnotation xyannotation =
274 new XYImageAnnotation(10, 10, imageIcon.getImage());
275 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND);
246 } 276 }
247 277
248 278
249 protected NumberAxis createXAxis(String label) { 279 protected NumberAxis createXAxis(String label) {
250 return new NumberAxis(label); 280 return new NumberAxis(label);

http://dive4elements.wald.intevation.org