# HG changeset patch # User Felix Wolfsteller # Date 1372327329 -7200 # Node ID 6aac9ad1f8a8f4e0587b533d4eb1f34a30aa7f82 # Parent 70185cd480581ce8da7bb31643265bc7e8a0e92b issue1370: FixWQCurveGenerator: second y axis for fix-w/q diagrams. diff -r 70185cd48058 -r 6aac9ad1f8a8 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Jun 27 11:53:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Jun 27 12:02:09 2013 +0200 @@ -216,6 +216,7 @@ doWQOut(aaf.getData(context), aaf, doc, visible); } else if (name.equals(DISCHARGE_CURVE)) { + logger.debug("diso " + name); doDischargeOut( (WINFOArtifact) aaf.getArtifact(), aaf.getData(context), @@ -375,7 +376,20 @@ 0.0 , // start maxQ); // end - addAxisSeries(series, YAXIS.W.idx, visible); + double gaugeDatum = getCurrentGaugeDatum(); + + double factor = (gaugeDatum == 0d) ? 1d : 100d; + + if (gaugeDatum == 0d) { + addAxisSeries(series, YAXIS.W.idx, visible); + } + else { + // Use second axis at cm if at gauge. + for (int i = 0; i < series.getItemCount(); i++) { + series.updateByIndex(i, new Double(factor*(series.getY(i).doubleValue()-gaugeDatum))); + } + addAxisSeries(series, YAXIS.WCm.idx, visible); + } } else { logger.warn("doWQCurveOut: maxQ <= 0");