【发布时间】:2015-08-03 11:36:41
【问题描述】:
我使用 JFreeChart 来显示条形图,图表中条形的宽度很大。我想减小条的宽度,有没有相关的API,请告诉我..
【问题讨论】:
标签: java jfreechart bar-chart
我使用 JFreeChart 来显示条形图,图表中条形的宽度很大。我想减小条的宽度,有没有相关的API,请告诉我..
【问题讨论】:
标签: java jfreechart bar-chart
BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
renderer.setItemMargin(-2);
试试上面的代码。试着看看这个线程。
Width of the bar in Jfreechart
请注意上面的 sn-p 来自同一个线程。
作为对您评论的回答,以下是相同方法的 Java Doc
public void setItemMargin(double percent)
Sets the item margin and sends a RendererChangeEvent to all registered listeners. The value is expressed as a percentage of the available width for plotting all the bars, with the resulting amount to be distributed between all the bars evenly.
Parameters:
percent - the margin (where 0.10 is ten percent).
【讨论】: