Interface IChartGridLine
Represent grid lines of the chart.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IChartGridLine : IChartFillBorder
Properties
Border
Gets the grid line border. Read-only.
Declaration
IChartBorder Border { get; }
Property Value
Type |
---|
IChartBorder |
Examples
The following code illustrates how to access and format the IChartBorder for IChartGridLine
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set value axis minor gridLines to visible
chart.PrimaryValueAxis.HasMinorGridLines = true;
//Get value axis minor gridlines
IChartGridLine gridLine = chart.PrimaryValueAxis.MinorGridLines;
//Set minor gridlines broder properties
gridLine.Border.ColorIndex = ExcelKnownColors.Red;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
Methods
Delete()
Clears the chart grid lines.
Declaration
void Delete()
Examples
The following code illustrates how to delete the IChartGridLine for IChartAxis
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Deleting the major gridlines of value axis
chart.PrimaryValueAxis.MajorGridLines.Delete();
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}