render.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
render.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BASELINE_LEFT));
renderer.setBaseItemLabelsVisible(true);因为柱子图上的内容如果太多的话,都挤到一起了,所以想斜着写尽量不挤到一起啊!
或者有什么其他的解决方案吗?谢谢大家啊!
private static void configAxisChart(JFreeChart chart) {
chart.getLegend().setPosition(RectangleEdge.RIGHT);
chart.setBorderVisible(false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
}
其中CategoryLabelPositions.DOWN_45就是设置,斜45度。