Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 7104:eb3a2bc5d591 generator-refactoring
Add more Inversion logic to the DiagramGenerator
The diagram generator has the inverted / not inverted logic
so it should not be necessary to override some methods to
make it acutally work
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 23 Sep 2013 16:00:02 +0200 |
parents | 24f153ad1f40 |
children | ed8623b989f3 |
comparison
equal
deleted
inserted
replaced
7103:5009b151f146 | 7104:eb3a2bc5d591 |
---|---|
186 return outName; | 186 return outName; |
187 } | 187 } |
188 | 188 |
189 /** | 189 /** |
190 * Return left most data points x value (on first axis). | 190 * Return left most data points x value (on first axis). |
191 * Shortcut, especially to be overridden in (LS) charts where | |
192 * axis could be inverted. | |
193 */ | 191 */ |
194 protected double getLeftX() { | 192 protected double getLeftX() { |
193 if (isInverted()) { | |
194 return (Double)getXBounds(0).getUpper(); | |
195 } | |
195 return (Double)getXBounds(0).getLower(); | 196 return (Double)getXBounds(0).getLower(); |
196 } | 197 } |
197 | 198 |
198 | 199 |
199 /** | 200 /** |
200 * Return right most data points x value (on first axis). | 201 * Return right most data points x value (on first axis). |
201 * Shortcut, especially to be overridden in (LS) charts where | |
202 * axis could be inverted. | |
203 */ | 202 */ |
204 protected double getRightX() { | 203 protected double getRightX() { |
204 if (isInverted()) { | |
205 return (Double)getXBounds(0).getLower(); | |
206 } | |
205 return (Double)getXBounds(0).getUpper(); | 207 return (Double)getXBounds(0).getUpper(); |
206 } | 208 } |
207 | 209 |
208 | 210 |
209 /** Add a logo as background annotation to plot. */ | 211 /** Add a logo as background annotation to plot. */ |
831 } | 833 } |
832 | 834 |
833 | 835 |
834 /** | 836 /** |
835 * Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the | 837 * Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the |
836 * X axis. | 838 * X axis and applies the inversion if isInverted. |
837 * | 839 * |
838 * (Duplicate in TimeseriesChartGenerator) | 840 * (Duplicate in TimeseriesChartGenerator) |
839 * | 841 * |
840 * @param plot The XYPlot of the chart. | 842 * @param plot The XYPlot of the chart. |
841 */ | 843 */ |
852 Font.BOLD, | 854 Font.BOLD, |
853 getXAxisLabelFontSize()); | 855 getXAxisLabelFontSize()); |
854 | 856 |
855 xaxis.setLabelFont(labelFont); | 857 xaxis.setLabelFont(labelFont); |
856 xaxis.setTickLabelFont(labelFont); | 858 xaxis.setTickLabelFont(labelFont); |
859 | |
860 if (isInverted()) { | |
861 logger.debug("X-Axis.setInverted(true)"); | |
862 xaxis.setInverted(true); | |
863 } | |
857 } | 864 } |
858 | 865 |
859 | 866 |
860 /** | 867 /** |
861 * This method walks over all axes (domain and range) of <i>plot</i> and | 868 * This method walks over all axes (domain and range) of <i>plot</i> and |