修复 JFreeChart 中条形图的宽度和条形之间的间距
我有堆积条形图,其中列数是动态的,可以从 1 列更改为 n 列。我希望图表之间的间距和条形的宽度保持一致。我该如何解决它。请提出解决方案/想法。
I have stacked bar chart in which the number of columns is dynamic, can change from 1 to n columns. I want the spacing between the charts and width of the bar to be consistent. How do I fix it. Please suggest solutions / ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在堆叠条形图中,您可以使用
代码如下
In a Stacked Bar chart, you can change the spacing between bars using
Code is below
StackedBarRenderer
致力于使“[条形]之间的间距和条形宽度保持一致”。当列数发生变化时,尚不清楚您希望它做什么不同的事情。相关几何图形由父级 确定CalculateBarWidth()
等方法中的BarRenderer
,可以根据需要重写。另外,验证每个系列中的每个类别都有一个值。StackedBarRenderer
devotes some effort to making the "spacing between the [bars] and width of the bar to be consistent." It's not clear what you want it to do differently as the number of columns changes. The relevant geometry is determined by the parentBarRenderer
in such methods ascalculateBarWidth()
, which can be overridden as desired. Also, verify that there is a value for each category in each series.