Turning off grid on a time series chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Kenny Dubuisson

Turning off grid on a time series chart

Post by Kenny Dubuisson » Wed Dec 11, 2002 6:38 pm

I wish to turn off the x-y grid behind my chart lines on a basic time series chart. Is there a way to do this?
Thanks,
Kenny

David Gilbert

Re: Turning off grid on a time series chart

Post by David Gilbert » Wed Dec 11, 2002 11:47 pm

Yes. In 0.9.4, the grid lines are controlled and drawn by the axes. You can hide them completely using the setGridLinesVisible(...) method:

XYPlot plot = myChart.getXYPlot();
ValueAxis domainAxis = plot.getDomainAxis();
domainAxis.setGridLinesVisible(false);
ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setGridLinesVisible(true);

From past feedback, I've decided that the grid line settings should be moved to the plot class (that seems a more logical place to find them), so the API for this will change in 0.9.5.

Regards,

DG

Locked