Bar chart x axis labels overlapping

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ramesh.udari
Posts: 1
Joined: Thu Dec 01, 2011 10:33 am
antibot: No, of course not.

Bar chart x axis labels overlapping

Post by ramesh.udari » Thu Dec 01, 2011 10:54 am

Hi,

We have implemented bar chart by using jfreechart-1.0.4 version.When we generate the report char x axis label overlapping due to the large set of label.
Can anybody please help me out this problem.
Gentlemen It is an urgent,please respond asap if you know any input on this.
Thanks in advance.

This is my code spinet.

Code: Select all

private JFreeChart createChart2(CategoryDataset dataset,List Months,int startmonth,int endmonth)
	{
		JFreeChart chart = ChartFactory.createBarChart(" Component-wise TAT Chart" , "Components", "Percentage Of Issues Exceeding TAT (%)", dataset, PlotOrientation.VERTICAL, true, true, false);
		System.out.println("value of data set............."+dataset.toString());
		chart.setBackgroundPaint(java.awt.Color.white);
		CategoryPlot plot = chart.getCategoryPlot();

		plot.setBackgroundPaint(java.awt.Color.white);
		
		NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
		rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
		BarRenderer renderer = (BarRenderer)plot.getRenderer();
		renderer.setDrawBarOutline(false);
		java.awt.GradientPaint gp1 = new java.awt.GradientPaint(0.0F, 0.0F, java.awt.Color.red, 0.0F, 0.0F, new java.awt.Color(0, 64, 0));
		renderer.setSeriesPaint(1, gp1);
		CategoryAxis domainAxis = plot.getDomainAxis();
		//HorizontalCategoryAxis axis = (HorizontalCategoryAxis)plot.getDomainAxis();
		//axis.setVerticalCategoryLabels(true);
		domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
		return chart;
	}

Image

Locked