Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 6559:6791411ed1fc
issue1370: Force second axis if at gauge.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 10 Jul 2013 14:49:21 +0200 |
parents | c5945aca0c8d |
children | 641f93a5fa9e |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Jul 10 14:26:31 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Jul 10 14:49:21 2013 +0200 @@ -21,6 +21,7 @@ import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.Marker; import org.jfree.chart.plot.ValueMarker; +import org.jfree.chart.plot.XYPlot; import org.jfree.chart.title.TextTitle; import org.jfree.data.xy.XYSeries; import org.jfree.ui.RectangleAnchor; @@ -153,6 +154,7 @@ return axis; } + /** Returns value != 0 if the current km is not at a gauge. */ public double getCurrentGaugeDatum() { if (context.getContextValue(CURRENT_KM) != null) { return DischargeCurveGenerator.getCurrentGaugeDatum( @@ -162,6 +164,16 @@ else return 0d; } + /** Overriden to show second axis also if no visible data present. */ + @Override + protected void adjustAxes(XYPlot plot) { + super.adjustAxes(plot); + if (getCurrentGaugeDatum() != 0d) { + // Show the W[*m] axis even if there is no data. + plot.setRangeAxis(1, createYAxis(YAXIS.W.idx)); + } + } + /** Translate River annotations if not at gauge. */ public void translateRiverAnnotation(RiverAnnotation riverAnnotation) { if (getCurrentGaugeDatum() == 0d) {