Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JFreeChart grid line Color

I am making a BarChart with JFreeChart in java. The default code makes a chart with dashed grid lines. As far as I can see, here is the only part of the code that deals with the gridlines.

   final CategoryPlot plot = chart1.getCategoryPlot();
                    plot.setBackgroundPaint(Color.white);
                    plot.setDomainGridlinePaint(Color.black);
                    plot.setRangeGridlinePaint(Color.black);

How would I edit this/add code to this so the grid lines are a solid color? Thanks.

like image 510
user3794422 Avatar asked Feb 12 '23 14:02

user3794422


1 Answers

In the CategoryPlot class, you will find the setDomainGridlineStroke() method - it let's you specify the line style for the x-axis gridlines. The setRangeGridlineStroke() method will do the same for the y-axis gridlines.

like image 78
David Gilbert Avatar answered Feb 15 '23 10:02

David Gilbert