Search code examples
colorsjfreechartgridlines

JFreeChart gridline? paint set


Chart
I have this chart and I want the line at 0 to be WHITE instead of BLACK, but I'm not sure which property I have to change.

I've already tried:

((CategoryPlot) chart.getPlot()).getDomainAxis().setAxisLinePaint(Color.WHITE);
((CategoryPlot) chart.getPlot()).setDomainGridlinePaint(Color.WHITE);
((CategoryPlot) chart.getPlot()).setRangeGridlinePaint(Color.WHITE);

And none of them seem to be what I need. I also tried searching for a solution, but I'm not sure what this line is called exactly, so I don't really know what to search for. Can someone please tell me which property I need to set to WHITE?


Solution

  • The line drawn perpendicular to the range axis (y-axis) at the value zero is referred to in JFreeChart as the rangeZeroBaseline. The method you need is:

    http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/CategoryPlot.html#setRangeZeroBaselinePaint-java.awt.Paint-