Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 7143:053e39436ba3
Diagrams: Determine if axis should be inverted dynamically.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 25 Sep 2013 12:36:19 +0200 |
parents | 49ceab5f2263 |
children | 2fd238b681a9 |
comparison
equal
deleted
inserted
replaced
7142:8c70767028e1 | 7143:053e39436ba3 |
---|---|
124 DiagramAttributes da = (DiagramAttributes)config; | 124 DiagramAttributes da = (DiagramAttributes)config; |
125 diagramAttributes = da.new Instance(); | 125 diagramAttributes = da.new Instance(); |
126 } | 126 } |
127 | 127 |
128 @Override | 128 @Override |
129 public void init(String outName, Document request, | 129 public void init( |
130 OutputStream out, CallContext context) { | 130 String outName, |
131 Document request, | |
132 OutputStream out, | |
133 CallContext context | |
134 ) { | |
131 super.init(outName, request, out, context); | 135 super.init(outName, request, out, context); |
132 | 136 |
133 RiverUtils.setKMFromRequestInContext(request, context); | 137 RiverUtils.setKMFromRequestInContext(request, context); |
134 } | 138 |
135 | 139 setInvertedFromConfig(); |
140 } | |
141 | |
142 private void setInvertedFromConfig() { | |
143 DiagramAttributes.DomainAxisAttributes dx = | |
144 diagramAttributes.getDomainAxis(); | |
145 | |
146 if (dx != null) { | |
147 inverted = (Boolean)dx.isInverted() | |
148 .evaluate((D4EArtifact)getMaster(), context); | |
149 } | |
150 } | |
136 | 151 |
137 /** | 152 /** |
138 * Generate the chart anew (including localized axis and all). | 153 * Generate the chart anew (including localized axis and all). |
139 */ | 154 */ |
140 @Override | 155 @Override |
1014 /** | 1029 /** |
1015 * Get internationalized label for the x axis. | 1030 * Get internationalized label for the x axis. |
1016 */ | 1031 */ |
1017 @Override | 1032 @Override |
1018 protected String getDefaultXAxisLabel() { | 1033 protected String getDefaultXAxisLabel() { |
1019 DiagramAttributes.Title dTitle = diagramAttributes.getDomainAxisTitle(); | 1034 DiagramAttributes.DomainAxisAttributes dx = |
1020 if (dTitle == null) { | 1035 diagramAttributes.getDomainAxis(); |
1021 return "Domain Axis Title not configured in conf.xml"; | 1036 |
1022 } | 1037 if (dx != null) { |
1023 | 1038 DiagramAttributes.Title t = dx.getTitle(); |
1024 return dTitle.evaluate((D4EArtifact)getMaster(), context); | 1039 if (t != null) { |
1040 return t.evaluate((D4EArtifact)getMaster(), context); | |
1041 } | |
1042 } | |
1043 return "Domain Axis Title not configured in conf.xml"; | |
1025 } | 1044 } |
1026 | 1045 |
1027 @Override | 1046 @Override |
1028 protected String getDefaultYAxisLabel(String axisName) { | 1047 protected String getDefaultYAxisLabel(String axisName) { |
1029 String label; | 1048 String label; |