如何在 JfreeChart 中包装类别标签

发布于 2024-08-31 04:46:47 字数 181 浏览 4 评论 0原文

我使用 JFreeChart 创建了堆积条形图。该类别的标签相当大,并且与下一个 Bar 的标签重叠。我想将其换行到下一行。我做了一些搜索,发现我必须使用下面的代码。 CategoryAxis 中的 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.

Please suggest solutions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落在眉间の轻吻 2024-09-07 04:46:47

更改 BarChartDemo1 代码 如图所示并使用长类别名称,我看到下面的图表。它似乎也适用于堆叠渲染。这是想要的效果吗?

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

image

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

image

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文