# HG changeset patch # User Ingo Weinzierl # Date 1331737965 0 # Node ID 8cd6358eb7f8c7627a0a0d4fa1bf66f35c6a98c1 # Parent a71fc8f2030c796344129ac38d79069a356dd42b Enabeld axes label font sizes for timeseries charts. flys-artifacts/trunk@4141 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a71fc8f2030c -r 8cd6358eb7f8 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Mar 14 15:00:30 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Mar 14 15:12:45 2012 +0000 @@ -1,3 +1,13 @@ +2012-03-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java: + Copied the adjustAxes() method from XYChartGenerator which enables axes + label font sizes. + + * src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java: + Removed unnecessary axes creation method which is implemented in upper + classes. + 2012-03-14 Raimund Renkert Issue 640. diff -r a71fc8f2030c -r 8cd6358eb7f8 flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java Wed Mar 14 15:00:30 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java Wed Mar 14 15:12:45 2012 +0000 @@ -8,7 +8,6 @@ import org.apache.log4j.Logger; import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.title.TextTitle; import org.jfree.data.general.SeriesException; @@ -129,30 +128,6 @@ } - /** - * Creates a new Y-Axis. - * - * @param index the index of the Y axis. - * - * @return an new NumberAxis with label from getYAxisLabel(). - */ - @Override - protected NumberAxis createYAxis(int index) { - Font labelFont = new Font("Tahoma", Font.BOLD, 14); - String label = "default"; - - if (index == YAXIS.Q.idx) { - label = getYAxisLabel(0); - } - - NumberAxis axis = createNumberAxis(index, label); - axis.setLabelFont(labelFont); - axis.setAutoRangeIncludesZero(false); - - return axis; - } - - public void doOut( ArtifactAndFacet artifactFacet, Document theme, diff -r a71fc8f2030c -r 8cd6358eb7f8 flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Wed Mar 14 15:00:30 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java Wed Mar 14 15:12:45 2012 +0000 @@ -1,6 +1,7 @@ package de.intevation.flys.exports; import java.awt.Color; +import java.awt.Font; import java.util.ArrayList; import java.util.HashMap; @@ -168,6 +169,7 @@ addSubtitles(chart); adjustPlot(plot); addDatasets(plot); + adjustAxes(plot); adaptZoom(plot); @@ -491,5 +493,28 @@ total.applyBounds(axis, AXIS_SPACE); } } + + + /** + * Adjusts the axes of a plot. This method sets the labelFont of the + * X axis. + * + * @param plot The XYPlot of the chart. + */ + protected void adjustAxes(XYPlot plot) { + ValueAxis xaxis = plot.getDomainAxis(); + + ChartSettings chartSettings = getChartSettings(); + if (chartSettings == null) { + return; + } + + Font labelFont = new Font( + DEFAULT_FONT_NAME, + Font.BOLD, + getXAxisLabelFontSize()); + + xaxis.setLabelFont(labelFont); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :