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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With