Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthChartExtender.java @ 8937:8596f95673b1
Tkh theme should only be pressed to bottom if other themes are present
author | gernotbelger |
---|---|
date | Tue, 06 Mar 2018 17:08:51 +0100 |
parents | ffebc94cf679 |
children | 6b2496d71936 |
comparison
equal
deleted
inserted
replaced
8936:93ea282c33e8 | 8937:8596f95673b1 |
---|---|
19 | 19 |
20 /** | 20 /** |
21 * @author Gernot Belger | 21 * @author Gernot Belger |
22 */ | 22 */ |
23 public class FlowDepthChartExtender implements ChartExtender { | 23 public class FlowDepthChartExtender implements ChartExtender { |
24 | |
25 private static final String TKH_AXIS = "tkhAxis"; | |
26 | |
27 private static final String FLOWDEPTH_AXIS = "flowdepthAxis"; | |
28 | |
29 @Override | |
30 public void beforeAutoZoom(final DiagramGenerator generator) { | |
31 final ValueAxis tkhAxis = generator.getAxis(TKH_AXIS); | |
32 if (tkhAxis != null) { | |
33 /* If tkh is not the only dataset, we push it to the bottom */ | |
34 final int numYAxes = generator.getNumYAxes(); | |
35 if (numYAxes > 1) | |
36 tkhAxis.setUpperMargin(4.0); | |
37 } | |
38 } | |
39 | |
24 /** | 40 /** |
25 * Synchronizes the location of '0' on the flow-depth-axis with the tkh-axis, by extending the lower bound of the | 41 * Synchronizes the location of '0' on the flow-depth-axis with the tkh-axis, by extending the lower bound of the |
26 * flow-depth-axis. | 42 * flow-depth-axis. |
27 */ | 43 */ |
28 @Override | 44 @Override |
29 public void afterAutoZoom(final DiagramGenerator generator) { | 45 public void afterAutoZoom(final DiagramGenerator generator) { |
30 final ValueAxis axis1 = generator.getAxis("flowdepthAxis"); | 46 final ValueAxis axis1 = generator.getAxis(FLOWDEPTH_AXIS); |
31 final ValueAxis axis2 = generator.getAxis("tkhAxis"); | 47 final ValueAxis axis2 = generator.getAxis(TKH_AXIS); |
32 if (axis1 == null || axis2 == null) | 48 if (axis1 == null || axis2 == null) |
33 return; | 49 return; |
34 | 50 |
35 final double axis2lb = axis2.getLowerBound(); | 51 final double axis2lb = axis2.getLowerBound(); |
36 final double axis1ub = axis1.getUpperBound(); | 52 final double axis1ub = axis1.getUpperBound(); |
42 axis1.setLowerBound(axis1lbNew); | 58 axis1.setLowerBound(axis1lbNew); |
43 } | 59 } |
44 | 60 |
45 @Override | 61 @Override |
46 public void afterGenerateChart(final DiagramGenerator generator, final XYPlot plot) { | 62 public void afterGenerateChart(final DiagramGenerator generator, final XYPlot plot) { |
47 | 63 final ValueAxis tkhAxis = generator.getAxis(TKH_AXIS); |
48 final ValueAxis tkhAxis = generator.getAxis("tkhAxis"); | |
49 if (tkhAxis != null) { | 64 if (tkhAxis != null) { |
50 /* show baseline if tkhAxis is present */ | 65 /* show baseline if tkhAxis is present */ |
51 | 66 |
52 // TODO: it would probably better to configure this via the ChartSettings, but currently no chart settings are loaded, | 67 // TODO: it would probably better to configure this via the ChartSettings, but currently no chart settings are loaded, |
53 // so it is unclear if that feature still works. | 68 // so it is unclear if that feature still works. |