Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java @ 8455:6dfc3a1fc70d
(issue1764) Set upper-time and lower-time for time series axes
This introduces new optional chart settings. Upper-time and
lower-time. If they are present the client can show a date selection
and they can be used for the domain axis in timeseries diagrams.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 29 Oct 2014 19:51:39 +0100 |
parents | 42b258294067 |
children | be5ce2882708 |
comparison
equal
deleted
inserted
replaced
8454:7003cf5c19ed | 8455:6dfc3a1fc70d |
---|---|
139 /** | 139 /** |
140 * Return left most data points x value (on first axis). | 140 * Return left most data points x value (on first axis). |
141 * Shortcut, especially to be overridden in (LS) charts where | 141 * Shortcut, especially to be overridden in (LS) charts where |
142 * axis could be inverted. | 142 * axis could be inverted. |
143 */ | 143 */ |
144 protected double getLeftX() { | 144 protected long getLeftX() { |
145 return (Long)getXBounds(0).getLower(); | 145 return (Long)getXBounds(0).getLower(); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 /** | 149 /** |
150 * Return right most data points x value (on first axis). | 150 * Return right most data points x value (on first axis). |
151 * Shortcut, especially to be overridden in (LS) charts where | 151 * Shortcut, especially to be overridden in (LS) charts where |
152 * axis could be inverted. | 152 * axis could be inverted. |
153 */ | 153 */ |
154 protected double getRightX() { | 154 protected long getRightX() { |
155 return (Long)getXBounds(0).getUpper(); | 155 return (Long)getXBounds(0).getUpper(); |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 /** | 159 /** |
837 public double above(double percent, double base) { | 837 public double above(double percent, double base) { |
838 return base + yRange.getLength() * percent; | 838 return base + yRange.getLength() * percent; |
839 } | 839 } |
840 } | 840 } |
841 | 841 |
842 /* Create an axis section with setUpperTimeRange and | |
843 * setLowerTimeRange */ | |
844 @Override | |
845 protected List<AxisSection> buildXAxisSections() { | |
846 List<AxisSection> axisSections = new ArrayList<AxisSection>(); | |
847 | |
848 String identifier = "X"; | |
849 | |
850 AxisSection axisSection = new AxisSection(); | |
851 axisSection.setIdentifier(identifier); | |
852 axisSection.setLabel(getXAxisLabel()); | |
853 axisSection.setFontSize(14); | |
854 axisSection.setFixed(false); | |
855 | |
856 axisSection.setUpperTimeRange(getRightX()); | |
857 axisSection.setLowerTimeRange(getLeftX()); | |
858 | |
859 axisSections.add(axisSection); | |
860 | |
861 return axisSections; | |
862 } | |
863 | |
864 | |
842 } | 865 } |
843 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 866 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |