Linechart and label positions / overlapping

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
de_tom
Posts: 2
Joined: Wed Oct 11, 2006 8:43 am

Linechart and label positions / overlapping

Post by de_tom » Wed Oct 11, 2006 8:49 am

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

adnanak
Posts: 5
Joined: Sat Oct 14, 2006 9:09 am

Post by adnanak » Thu Oct 19, 2006 10:46 am

Can u send me the code that u r using to display the chart.

de_tom
Posts: 2
Joined: Wed Oct 11, 2006 8:43 am

Post by de_tom » Thu Oct 19, 2006 12:43 pm

Hi,

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);	
Any help would still be appreciated since this is still one open issue for me.

Regards,
Tom

Locked