Width of the bar in Jfreechart

前端 未结 4 1820
眼角桃花
眼角桃花 2020-12-09 09:56

Is there a way to adjust the width of the bars in a Barchart?

I create my chart with the following code.

final JFreeChart chart = ChartFactory.create         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 10:32

    After getting no results using positive margins and zero, I tried using negative numbers for itemMargin to see what would happen. The bars started getting thicker. I don't know if this is recommended, though, since you will get overlap if there is not enough space available.

    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setItemMargin(-2);
    

提交回复
热议问题