Interface IChartShape
Represents an embedded chart in the worksheet.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IChartShape : IShape, IChart, ITabSheet, IParentApplication
Properties
BottomRow
Gets or sets the bottom row of the chart. Default value for bottom row is 20.
Declaration
int BottomRow { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of BottomRow property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Column_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the bottom row of the chart
chart.BottomRow = 20;
chart.TopRow = 5;
chart.LeftColumn = 5;
chart.RightColumn = 13;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
LeftColumn
Gets or sets the left column of the chart. Default value for left column is 1.
Declaration
int LeftColumn { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of LeftColumn property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Column_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the left column of the chart
chart.LeftColumn = 5;
chart.TopRow = 5;
chart.BottomRow = 20;
chart.RightColumn = 13;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
Name
Gets or sets the name of the chart. Default value for name of chart is "Chart 1".
Declaration
string Name { get; set; }
Property Value
Type |
---|
System.String |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of Name property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.ChartType = ExcelChartType.Column_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the name of the chart.
chart.Name = "Student Sample Chart";
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
RightColumn
Gets or sets the right column of the chart. Default value for right column is 10.
Declaration
int RightColumn { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of RightColumn property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Column_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the right column of the chart
chart.RightColumn = 13;
chart.TopRow = 5;
chart.BottomRow = 20;
chart.LeftColumn = 5;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
TopRow
Gets or sets the top row of the chart. Default value for top row is 1.
Declaration
int TopRow { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates the use of TopRow property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].Text = "Student ID";
sheet.Range["B1"].Text = "Student Name";
sheet.Range["C1"].Text = "Mark(Out of 100)";
sheet.Range["A1:C1"].AutofitColumns();
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Number = 2;
sheet.Range["A4"].Number = 3;
sheet.Range["A5"].Number = 4;
sheet.Range["A6"].Number = 5;
sheet.Range["B2"].Text = "Andrew";
sheet.Range["B3"].Text = "Marson";
sheet.Range["B4"].Text = "Jack";
sheet.Range["B5"].Text = "Sam";
sheet.Range["B6"].Text = "Breto";
sheet.Range["C2"].Number = 77;
sheet.Range["C3"].Number = 45;
sheet.Range["C4"].Number = 92;
sheet.Range["C5"].Number = 39;
sheet.Range["C6"].Number = 55;
//Create a Chart
IChartShape chart = sheet.Charts.Add();
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Column_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the top row of the chart
chart.TopRow = 5;
chart.BottomRow = 20;
chart.LeftColumn = 5;
chart.RightColumn = 13;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}