[]
Use this interface to access the formatting of chart axis gridlines and to navigate to the owning IAxis. Gridlines are typically obtained from IAxis.getMajorGridlines() or IAxis.getMinorGridlines().
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 250, 20, 360, 230);
worksheet.getRange("A1:B4").setValue(new Object[][] {{"Month", "Sales"}, {"Jan", 10}, {"Feb", 25}, {"Mar", 18}});
shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
IAxis valueAxis = shape.getChart().getAxes().item(AxisType.Value);
valueAxis.setHasMajorGridlines(true);
IGridlines gridlines = valueAxis.getMajorGridlines();
gridlines.getFormat().getLine().getColor().setRGB(Color.GetGray());
IAxis object that contains these gridlines.IAxis object that contains these gridlines.Use this method to access the parent axis of major or minor gridlines on a chart.
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
axis.setHasMajorGridlines(true);
IGridlines gridlines = axis.getMajorGridlines();
IAxis parentAxis = gridlines.getParent();
IAxis object that contains these gridlines.Use the returned IChartFormat object to access and modify the formatting applied to major or minor gridlines on a chart axis.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 10},
{"Feb", 15}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 0, 0, 300, 200);
shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B3"));
IGridlines gridlines = shape.getChart().getAxes().item(AxisType.Value).getMajorGridlines();
IChartFormat format = gridlines.getFormat();
format.getLine().getColor().setRGB(Color.GetBlue());
IChartFormat object that represents the gridline formatting.