1

I am developing a javaEE application using jfreecharts. I successfully displayed my data using a stackedBarChart but the column keys (Y-axis labels) are not fully displayed because they are too large. how can I display them vertically? thanks for your suggestions

The Prince
  • 169
  • 1
  • 6

1 Answers1

3

You can use setCategoryLabelPositions() like they show here.

CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90));
Community
  • 1
  • 1
Catalina Island
  • 7,027
  • 2
  • 23
  • 42
  • Thanks a lot for your response. I get an error, saying that the method createUpRotationLabelPositions needs a double as argument and CategoryLabelPositions cannot be converted to a double. However I found a similar solution [Here](http://www.java2s.com/Code/Java/Chart/JFreeChartDualAxisDemo.htm). the only difference is that the method createUpRotationLabelPositions is not invoked. so it's simply CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); – The Prince May 02 '13 at 14:29