如何在JfreeChart中包装类别标签 [英] How to wrap category labels in JfreeChart

查看:116
本文介绍了如何在JfreeChart中包装类别标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用JFreeChart创建了堆积条形图.类别的标签很大,并且与下一个Bar的标签重叠.我想将其包装到下一行.我做了一些搜索,发现我必须使用下面的代码. 类别轴中的setMaximumCategoryLabelLines(2) 仍然不会包装到下一行.

I have Stacked Bar Chart created using JFreeChart. The labels of the category are quite big and they overlap with the label of the next Bar. I would like to wrap it to the next line. I did some searching and found that i have to use the below code. setMaximumCategoryLabelLines(2) in the CategoryAxis and still it doesn't wrap to the next line.

请提出解决方案.

推荐答案

更改

Altering the BarChartDemo1 code as shown and using long category names, I see the chart below. It seems to work with stacked rendering, too. Is that the desired effect?

private static JFreeChart createChart(CategoryDataset dataset) {
    ...
    // OPTIONAL CUSTOMISATION COMPLETED.
    domainAxis.setMaximumCategoryLabelLines(2);
    ...
}

这篇关于如何在JfreeChart中包装类别标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆