开发者

How to wrap category labels in JfreeChart

开发者 https://www.devze.com 2022-12-29 03:30 出处:网络
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 search

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. setMaximumCatego开发者_开发知识库ryLabelLines(2) in the CategoryAxis and still it doesn't wrap to the next line.

Please suggest solutions.


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);
    ...
}

How to wrap category labels in JfreeChart

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号