I think I found a bug with the PeriodAxis that persist even in the rc1 version. I have tried the following code slab with 0.9.21, pre2 and rc1.
Code: Select all
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.PeriodAxis;
public class PeriodAxisTest {
public static void main(String[] args) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"Test", "Category", "Value", null, false, false, false);
chart.getXYPlot().setDomainAxis(new PeriodAxis("Period"));
chart.getXYPlot().getDomainAxis().setLabelPaint(Color.white); // works
chart.getXYPlot().getDomainAxis().setTickLabelPaint(Color.white); // doesn't work
chart.getXYPlot().getDomainAxis().setTickLabelsVisible(false); // doesn't work
try
{
File chartFile = new File("PeriodAxisTest.png");
ChartUtilities.saveChartAsPNG(chartFile, chart, 640, 480);
}
catch (IOException e)
{
System.out.print(e);
}
}
}
I would assume that the setTickLabelsVisible(false) hides the tick labels. This in fact works with other Axis but not with PeriodAxis. Similarily I would expect that the font of the tick labels turn to white upon the setTickLabelPaint(Color.white) calls.
However neither seems to do their job.
At this stage I will have to look at another method to hide the axis tick labels if there is no data for my chart available. Any recommendations?
Thanks a lot for the great jfreechart!
Manfred[/code]