英文:
JFreeChart align Bar Chart left
问题
使用JFreeChart打印了一个条形图。但是,如果我想使用setCategoryMargin(-2)
在我的CategoryAxis
上使条形更靠近彼此,那么条形图似乎会居中对齐。
有没有办法将整个图形与左侧对齐,使其直接位于y轴旁边?或者减小条之间的间距,而不使图表居中?
英文:
I printed a bar chart using JFreeChart. But if I want to make the bars closer to each other using setCategoryMargin(-2)
on my CategoryAxis
, the Bar Chart appears to align in the center.
Is there a way to align the entire graph to the left, so it's directly next to the y-axis ? Or reduce the space between the bars without the chart getting centered ?
答案1
得分: 0
setCategoryMargin(float)
用于调整类别之间的间距,接受一个介于 0.0 和 1.0 之间的值(其中 1.0 表示使用可用空间的 100% 作为边距!)。因此,使用负值(-2)可能不会产生预期的结果。
阅读更多信息:https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/CategoryAxis.html#setCategoryMargin-double-
您可以尝试设置不同的较低正边距,以看看哪个适合您的需求。
英文:
The setCategoryMargin(float)
is used to adjust the space between categories and accepts a value between 0.0 and 1.0 (where 1.0 means 100% of the available space is used as the margin(!)). So using a negative value (-2) may not give the expected result.
You can try setting different lower positive margin to to see what suits your needs.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论