我使用JFreeChart显示条形图,图形中条形的宽度很大。我想减少条的宽度,是否有任何API,请告诉我..
答案 0 :(得分:-1)
BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
renderer.setItemMargin(-2);
试试上面的代码。试着看看这个帖子。
Width of the bar in Jfreechart
请注意上面的代码片段来自同一个帖子。
作为对您的评论的回答,以下是相同方法的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).