我使用 JFreeChart 来显示条形图,图中条形的宽度很大。我想减少条形的宽度,有没有相关的API,请告诉我..
最佳答案
BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
renderer.setItemMargin(-2);
尝试上面的代码。也尝试看看这个线程。
Width of the bar in Jfreechart
请注意上面的代码片段来自同一线程。
作为对您评论的回答,以下是相同方法的 Java 文档
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).
关于java - 减少java中条形图的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31786224/