Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java @ 7691:fa4fbd66e752
(issue1579) Fix axes syncronisation at Gauges
The SyncNumberAxis was completely broken. It only synced
in one direction and even that did not work correctly when
data was added to the axis (and the syncAxis rescaled but
forgot the old axis) then there were lots of ways to bypass
that scaling. And i also think the trans calculation was wrong.
It has been replaced by a "mostly" simple method to just keep
the W in M and W in CM+Datum axes in sync. I say "Mostly" because
it had to deal with the Bounds interface.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 13 Dec 2013 19:03:00 +0100 |
parents | b64c263df4d1 |
children | 75ef6963f1c9 |
comparison
equal
deleted
inserted
replaced
7690:4bbd222e6b7f | 7691:fa4fbd66e752 |
---|---|
59 "chart.computed.discharge.curve.yaxis.label"; | 59 "chart.computed.discharge.curve.yaxis.label"; |
60 | 60 |
61 public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; | 61 public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; |
62 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; | 62 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; |
63 | 63 |
64 protected NumberAxis firstYAxis; | |
65 | |
66 /** Trivial Constructor. */ | 64 /** Trivial Constructor. */ |
67 public ComputedDischargeCurveGenerator () { | 65 public ComputedDischargeCurveGenerator () { |
68 super(); | 66 super(); |
69 } | 67 } |
70 | 68 |
97 if (pos == 0 && getCurrentGaugeDatum() != 0) | 95 if (pos == 0 && getCurrentGaugeDatum() != 0) |
98 unit = "cm"; | 96 unit = "cm"; |
99 | 97 |
100 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); | 98 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); |
101 } | 99 } |
102 | |
103 | |
104 /** | |
105 * Create Y (range) axis for given index, here with a special axis | |
106 * that depends on other axis (does translation and scaling for | |
107 * special case at gauge in cm). | |
108 * @return A NumberAxis, possibly scaled. | |
109 */ | |
110 @Override | |
111 protected NumberAxis createYAxis(int index) { | |
112 if (index == 0) { | |
113 firstYAxis = super.createYAxis(0); | |
114 return firstYAxis; | |
115 } | |
116 YAxisWalker walker = getYAxisWalker(); | |
117 | |
118 Font labelFont = new Font( | |
119 DEFAULT_FONT_NAME, | |
120 Font.BOLD, | |
121 getYAxisFontSize(index)); | |
122 | |
123 SyncNumberAxis axis = new SyncNumberAxis( | |
124 walker.getId(index), | |
125 getYAxisLabel(index), | |
126 firstYAxis); | |
127 | |
128 axis.setAutoRangeIncludesZero(false); | |
129 axis.setLabelFont(labelFont); | |
130 axis.setTickLabelFont(labelFont); | |
131 axis.setShift((double)-getCurrentGaugeDatum()); | |
132 | |
133 return axis; | |
134 } | |
135 | |
136 | 100 |
137 /** | 101 /** |
138 * Process data, build up plot. | 102 * Process data, build up plot. |
139 */ | 103 */ |
140 @Override | 104 @Override |