Create barchart using jfreechart with bars of same category together

后端 未结 2 1051
生来不讨喜
生来不讨喜 2021-01-18 23:04

I want to make bar chart using jfreechart such that the bars which belong to the same category should be displayed adjacent without any gaps. The categories should be displa

2条回答
  •  天涯浪人
    2021-01-19 00:07

    I am aware of the age of this post. Anyway I am posting my solution, maybe someone else who will find himself here looking for the answer will find it useful.

    I was looking for the answer but didn't find it and had to figure it out myself.

    That is the code I use:

    BarRenderer br = new BarRenderer();
    br.setItemMargin(0.0);
    chart.getCategoryPlot().setRenderer(br);
    

提交回复
热议问题