# HG changeset patch # User Felix Wolfsteller # Date 1346160098 0 # Node ID d4751be547454bb97a48788f081ddbf7d7092c61 # Parent f84854eba0b372f8aef7137c450a004860866388 Add rather faked image annotations to chart, if property is set accordingly. flys-artifacts/trunk@5282 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f84854eba0b3 -r d4751be54745 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Aug 28 12:47:11 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Aug 28 13:21:38 2012 +0000 @@ -1,3 +1,26 @@ +2012-08-28 Felix Wolfsteller + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + (addLogo): New, add an image annotation to plot, very stubby, + use hard-coded paths for now. + +2012-08-28 Felix Wolfsteller + + Preparations for logo-inclusion in charts. + + * src/main/java/de/intevation/flys/exports/ChoiceStringAttribute.java: + New string attribute type to trigger different UI (selectboxes) + in client. + + * src/main/java/de/intevation/flys/exports/TypeSection.java + (setChoiceStringValue): Create new ChoiceStringAttribute. + + + * src/main/java/de/intevation/flys/exports/ChartSection.java, + src/main/java/de/intevation/flys/exports/ChartGenerator.java, + src/main/java/de/intevation/flys/exports/ChartSettings.java: + Accessors to show logo-property. + 2012-08-28 Raimund Renkert MINFO: Implemented UI and facet/artifact stack for bed height differences. diff -r f84854eba0b3 -r d4751be54745 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Tue Aug 28 12:47:11 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Tue Aug 28 13:21:38 2012 +0000 @@ -11,6 +11,7 @@ import java.awt.Color; import java.awt.Font; +import javax.swing.ImageIcon; import java.text.NumberFormat; @@ -25,6 +26,8 @@ import org.jfree.chart.JFreeChart; import org.jfree.chart.LegendItem; +import org.jfree.chart.annotations.XYAnnotation; +import org.jfree.chart.annotations.XYImageAnnotation; import org.jfree.chart.annotations.XYTextAnnotation; import org.jfree.chart.axis.NumberAxis; @@ -240,12 +243,39 @@ // These have to go after the autozoom. addAnnotationsToRenderer(plot); + // Add a logo (maybe). + addLogo(plot); + aggregateLegendEntries(plot); return chart; } + /** Add a logo as background annotation to plot. */ + protected void addLogo(XYPlot plot) { + String logo = showLogo(); + if (logo == null) { + logger.debug("No logo to show chosen"); + return; + } + + ImageIcon imageIcon = null; + // TODO: Which logo? + if (logo.equals("Intevation")) { + imageIcon = new ImageIcon("/home/felix/Downloads/intevation_logo_120.png"); + } + else { + imageIcon = new ImageIcon("/home/felix/Downloads/bfg_logo.gif"); + } + + // TODO placement should be decided by from other properties. + XYAnnotation xyannotation = + new XYImageAnnotation(10, 10, imageIcon.getImage()); + plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); + } + + protected NumberAxis createXAxis(String label) { return new NumberAxis(label); }