# HG changeset patch # User Felix Wolfsteller # Date 1381217169 -7200 # Node ID 0e6b399e72f9a89acfb3a8034784d2a8f43f4e99 # Parent 88b70c788b0f4614da6cd1f778fc574fff4d3649 issue1490: Translate text annotations position when displaying w/q- curve at gauge. diff -r 88b70c788b0f -r 0e6b399e72f9 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Oct 08 09:00:45 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Oct 08 09:26:09 2013 +0200 @@ -319,20 +319,28 @@ DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.SHORT); - series.add(qwd.getQ(), qwd.getW(), false); + double gaugeDatum = getCurrentGaugeDatum(); + double factor = (gaugeDatum == 0d) ? 1d : 100d; + series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( dateFormat.format(qwd.getDate()), qwd.getQ(), - qwd.getW()); + factor*(qwd.getW()-gaugeDatum)); textAnnos.add(anno); - addAxisSeries(series, YAXIS.W.idx, visible); if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); } + + if (gaugeDatum == 0d) { + addAxisSeries(series, YAXIS.W.idx, visible); + } + else { + addAxisSeries(series, YAXIS.WCm.idx, visible); + } } @@ -568,8 +576,22 @@ } XYSeries series = new StyledXYSeries(description, theme); - StyledSeriesBuilder.addPointsQW(series, wqkms); - addAxisSeries(series, YAXIS.W.idx, visible); + + double gaugeDatum = getCurrentGaugeDatum(); + + if (true || gaugeDatum == 0d) { + StyledSeriesBuilder.addPointsQW(series, wqkms); + addAxisSeries(series, YAXIS.W.idx, visible); + } + else { + XYSeries series2 = new StyledXYSeries(description, theme); + StyledSeriesBuilder.addPointsQW(series2, wqkms); + addAxisSeries(series2, YAXIS.W.idx, false); + + // Use second axis... + StyledSeriesBuilder.addPointsQW(series, wqkms, -gaugeDatum, 100d); + addAxisSeries(series, YAXIS.WCm.idx, visible); + } }