4

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.

Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
user3794422
  • 311
  • 1
  • 5
  • 17

1 Answers1

8

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.

David Gilbert
  • 4,427
  • 14
  • 22