Hi everybody,
I know, this has ben discussed before but unfortunately I have not found a solution to the the problem. When you plot a LineChart with lots of data, the x-axis labels will overlap. Now I've seen solutions in this forum, where people only want to display every other label, yet this does not work for me. I wonder whether it is possible to have all even labels on the bottom and all odd labels on top of the chart. While this does not solve the issue completely I am rather sure it would be enough for me (and lots of others as well, I hope).
Any input would be appreciated.
Regards,
Tom
Linechart and label positions / overlapping
Hi,
this is a simplified verson of my code - I suppose one has to alter the categoryLabelPositions yet I am not sure.
Any help would still be appreciated since this is still one open issue for me.
Regards,
Tom
this is a simplified verson of my code - I suppose one has to alter the categoryLabelPositions yet I am not sure.
Code: Select all
JFreeChart c = ChartFactory.createLineChart(chartName,
xAxisLabel,
yAxisLabel,
set,
PlotOrientation.VERTICAL,
true,
true,
true
);
c.setBackgroundPaint(Color.WHITE);
CategoryPlot cp = (CategoryPlot)c.getPlot();
cp.setOutlinePaint(Color.white);
LineAndShapeRenderer renderer = (LineAndShapeRenderer) cp.getRenderer();
cp.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
Regards,
Tom