Mercurial > dive4elements > river
changeset 3194:e815cf20bab2
Add point labels to W/Q curve
flys-artifacts/trunk@4810 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 27 Jun 2012 14:48:35 +0000 |
parents | 2f922be407ea |
children | e870d999ba0d |
files | flys-artifacts/doc/conf/conf.xml flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java |
diffstat | 3 files changed, 32 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/conf.xml Wed Jun 27 13:45:55 2012 +0000 +++ b/flys-artifacts/doc/conf/conf.xml Wed Jun 27 14:48:35 2012 +0000 @@ -267,6 +267,7 @@ <output-generator name="fix_deltawt_export">de.intevation.flys.exports.DeltaWtExporter</output-generator> <output-generator name="fix_deltawt_curve">de.intevation.flys.exports.fixings.FixDeltaWtGenerator</output-generator> <output-generator name="fix_longitudinal_section_curve">de.intevation.flys.exports.fixings.FixLongitudinalGenerator</output-generator> + <output-generator name="fix_derivate_curve">de.intevation.flys.exports.fixings.FixDerivedCurveGenerator</output-generator> <!-- Error report generators. --> <output-generator name="discharge_longitudinal_section_report">de.intevation.flys.exports.ReportGenerator</output-generator> <output-generator name="waterlevel_report">de.intevation.flys.exports.ReportGenerator</output-generator>
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Jun 27 13:45:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Jun 27 14:48:35 2012 +0000 @@ -808,7 +808,7 @@ /** - * Create annotation that sticks to the second Y axis ("right"). + * Create annotation that sticks to the first Y axis ("left"). * @param area helper to calculate coordinates * @param pos one-dimensional position (distance from axis) * @param lineStyle the line style to use for the line.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Wed Jun 27 13:45:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java Wed Jun 27 14:48:35 2012 +0000 @@ -11,13 +11,21 @@ import de.intevation.flys.exports.ChartGenerator; +import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; +import de.intevation.flys.jfree.FLYSAnnotation; import de.intevation.flys.jfree.JFreeUtil; import de.intevation.flys.jfree.StyledXYSeries; +import java.util.ArrayList; +import java.util.List; + import org.apache.log4j.Logger; +import org.jfree.chart.annotations.XYTextAnnotation; + import org.jfree.data.xy.XYSeries; + import org.w3c.dom.Document; public class FixWQCurveGenerator @@ -88,11 +96,8 @@ logger.debug("doSectorAverageOut"); QWD qwd = (QWD)aaf.getData(context); - if(qwd != null) { - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); - series.add(qwd.getQ(), qwd.getW()); - addAxisSeries(series, 0, visible); + addQWSeries(new QWD[] { qwd }, aaf, doc, visible); } else { logger.debug("doSectorAverageOut: qwd == null"); @@ -101,16 +106,11 @@ /** Add analysis event points to chart */ protected void doAnalysisEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { - logger.debug("doAnalysisEventsOut"); + logger.debug("doAnalysisEventsOut"); - QWD[] qwds = (QWD[])aaf.getData(context); - if(qwds != null) { - XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); - for(QWD qwd : qwds) { - series.add(qwd.getQ(), qwd.getW()); - } - - addAxisSeries(series, 0, visible); + QWD[] qwds = (QWD[])aaf.getData(context); + if(qwds != null) { + addQWSeries(qwds, aaf, doc, visible); } else { logger.debug("doAnalysisEventsOut: qwds == null"); @@ -145,7 +145,7 @@ doc, aaf.getFacetDescription(), 500, // number of samples - 0.0 , // start + 0.0 , // start func.getMaxQ()); // end addAxisSeries(series, 0, visible); @@ -165,11 +165,27 @@ protected void addQWSeries(QW[] qws, ArtifactAndFacet aaf, Document doc, boolean visible) { if(qws != null) { XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); + List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); + for(QW qw : qws) { series.add(qw.getQ(), qw.getW()); + + StringBuilder label = new StringBuilder(); + label.append(qw.getDate()); + label.append(" "); + label.append(qw.getDescription()); + + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( + label.toString(), + qw.getQ(), + qw.getW()); + textAnnos.add(anno); } + FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); + flysAnno.setTextAnnotations(textAnnos); addAxisSeries(series, 0, visible); + addVisibleAnnotations(flysAnno); } }