Mercurial > dive4elements > river
changeset 2586:8cd6358eb7f8
Enabeld axes label font sizes for timeseries charts.
flys-artifacts/trunk@4141 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 14 Mar 2012 15:12:45 +0000 |
parents | a71fc8f2030c |
children | bece6f604899 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java |
diffstat | 3 files changed, 35 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <raimund.renkert@intevation.de> Issue 640.
--- 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 <i>getYAxisLabel()</i>. - */ - @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,
--- 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 <i>labelFont</i> 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 :