Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 1990:5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
flys-artifacts/trunk@3426 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 15 Dec 2011 15:58:56 +0000 |
parents | 156304542edf |
children | 0bd7c3cf0af1 |
comparison
equal
deleted
inserted
replaced
1989:156304542edf | 1990:5c1e7c1e9e09 |
---|---|
36 import org.jfree.data.xy.XYDataset; | 36 import org.jfree.data.xy.XYDataset; |
37 | 37 |
38 import org.jfree.ui.RectangleInsets; | 38 import org.jfree.ui.RectangleInsets; |
39 | 39 |
40 import de.intevation.artifactdatabase.state.Facet; | 40 import de.intevation.artifactdatabase.state.Facet; |
41 import de.intevation.artifactdatabase.state.Section; | |
41 import de.intevation.artifactdatabase.state.Settings; | 42 import de.intevation.artifactdatabase.state.Settings; |
42 | 43 |
43 import de.intevation.flys.exports.ChartExportHelper; | 44 import de.intevation.flys.exports.ChartExportHelper; |
44 import de.intevation.flys.jfree.FLYSAnnotation; | 45 import de.intevation.flys.jfree.FLYSAnnotation; |
45 import de.intevation.flys.jfree.StickyAxisAnnotation; | 46 import de.intevation.flys.jfree.StickyAxisAnnotation; |
156 return null; | 157 return null; |
157 } | 158 } |
158 | 159 |
159 | 160 |
160 /** | 161 /** |
162 * This method is used to determine, if the chart's legend is visible or | |
163 * not. <b>Note: this method always returns true.</b> | |
164 * | |
165 * @return true, if the legend should be visible, otherwise false. | |
166 */ | |
167 protected boolean isLegendVisible() { | |
168 return true; | |
169 } | |
170 | |
171 | |
172 /** | |
173 * This method is used to determine the font size of the chart's legend. | |
174 * <b>Note: this method always returns 12.</b> | |
175 * | |
176 * @return 12. | |
177 */ | |
178 protected int getLegendFontSize() { | |
179 return 12; | |
180 } | |
181 | |
182 | |
183 /** | |
161 * This method is used to determine if the resulting chart should display | 184 * This method is used to determine if the resulting chart should display |
162 * grid lines or not. <b>Note: this method always returns true!</b> | 185 * grid lines or not. <b>Note: this method always returns true!</b> |
163 * | 186 * |
164 * @return true, if the chart should display grid lines, otherwise false. | 187 * @return true, if the chart should display grid lines, otherwise false. |
165 */ | 188 */ |
854 * @return an instance of <i>ChartSettings</i>. | 877 * @return an instance of <i>ChartSettings</i>. |
855 */ | 878 */ |
856 public Settings getSettings() { | 879 public Settings getSettings() { |
857 ChartSettings settings = new ChartSettings(); | 880 ChartSettings settings = new ChartSettings(); |
858 | 881 |
882 Section chartSection = buildChartSection(); | |
883 Section legendSection = buildLegendSection(); | |
884 | |
885 settings.setChartSection(chartSection); | |
886 settings.setLegendSection(legendSection); | |
887 | |
888 return settings; | |
889 } | |
890 | |
891 | |
892 /** | |
893 * Creates a new <i>ChartSection</i>. | |
894 * | |
895 * @return a new <i>ChartSection</i>. | |
896 */ | |
897 protected Section buildChartSection() { | |
859 ChartSection chartSection = new ChartSection(); | 898 ChartSection chartSection = new ChartSection(); |
860 chartSection.setTitle(getChartTitle()); | 899 chartSection.setTitle(getChartTitle()); |
861 chartSection.setSubtitle(getChartSubtitle()); | 900 chartSection.setSubtitle(getChartSubtitle()); |
862 chartSection.setDisplayGird(isGridVisible()); | 901 chartSection.setDisplayGird(isGridVisible()); |
863 | 902 return chartSection; |
864 settings.setChartSection(chartSection); | 903 } |
865 | 904 |
866 return settings; | 905 |
906 /** | |
907 * Creates a new <i>LegendSection</i>. | |
908 * | |
909 * @return a new <i>LegendSection</i>. | |
910 */ | |
911 protected Section buildLegendSection() { | |
912 LegendSection legendSection = new LegendSection(); | |
913 legendSection.setVisibility(isLegendVisible()); | |
914 legendSection.setFontSize(getLegendFontSize()); | |
915 return legendSection; | |
867 } | 916 } |
868 } | 917 } |
869 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 918 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |