Interface IChartFrameFormat
Represent the borders and layout options of the chart elements.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface IChartFrameFormat : IChartFillBorder
Properties
Border
Gets the border of the chart element. Read-only.
Declaration
IChartBorder Border { get; }
Property Value
Type |
---|
IChartBorder |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates use of Border 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.LeftColumn = 5;
chart.RightColumn = 11;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//border of the chart element
chart.ChartTitleArea.Text = "Sample Chart";
chart.ChartTitleArea.FrameFormat.Border.LineColor = System.Drawing.Color.Red;
chart.ChartTitleArea.FrameFormat.Border.LinePattern = ExcelChartLinePattern.DashDotDot;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
IsBorderCornersRound
True if the chart area has rounded corners. otherwise False.
Declaration
bool IsBorderCornersRound { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This property works only on chart Area. To know more about charts refer this link.
Examples
The following code illustrates use of IsBorderCornersRound 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.LeftColumn = 5;
chart.RightColumn = 11;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//True if the chart area has rounded corners
IChartFrameFormat chartArea = chart.ChartArea;
chartArea.IsBorderCornersRound = true;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
Layout
Gets or sets the layout settings of chart text area.
Declaration
IChartLayout Layout { get; set; }
Property Value
Type |
---|
IChartLayout |
Remarks
To know more about charts refer this link.
Examples
The following code illustrates use of Layout 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.LeftColumn = 5;
chart.RightColumn = 11;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the layout settings of plot area
chart.PlotArea.Layout.Height = 300;
chart.PlotArea.Layout.Width = 430;
chart.PlotArea.Layout.Top = 40;
chart.PlotArea.Layout.Left = 10;
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.factor;
workbook.SaveAs("Charts.xlsx");
workbook.Close();
}
RectangleStyle
Gets or sets the rectangle style for the chart element.
Declaration
ExcelRectangleStyle RectangleStyle { get; set; }
Property Value
Type |
---|
ExcelRectangleStyle |
Remarks
The RectangleStyle property works on Binary Excel format only. To know more about charts refer this link.
Examples
The following code illustrates use of RectangleStyle 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.LeftColumn = 5;
chart.RightColumn = 11;
chart.Name = "Student Sample Chart";
chart.ChartType = ExcelChartType.Cone_Clustered_3D;
chart.DataRange = sheet.Range["B2:C6"];
//sets the rectangle style for the chart element
chart.PlotArea.RectangleStyle = ExcelRectangleStyle.Shadowed;
workbook.SaveAs("Charts.xls");
workbook.Close();
}
Methods
Clear()
Declaration
void Clear()