GridLines are vertical and horizontal lines that are added in conjunction to the Tick Marks on the XAxis and the YAxis respectively. Adding Grid lines makes data in the chart easier to read and interpret. There are two types of Grid lines:
The below code shows how to add XAxisGridLines:
[Java]
Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.getPrimaryPlotArea();
plotArea.getXAxes().getDefaultNumericXAxis().setMajorGridLines(new XAxisGridLines());
plotArea.getXAxes().getDefaultNumericXAxis().setMinorGridLines( new XAxisGridLines());
The below code shows how to add YAxisGridLines:
[Java]
Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.getPrimaryPlotArea();
plotArea.getYAxes().getDefaultNumericYAxis().setMajorGridLines(new YAxisGridLines());
plotArea.getYAxes().getDefaultNumericYAxis().setMinorGridLines(new YAxisGridLines());