Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IChartManualLayout

    Show / Hide Table of Contents

    Interface IChartManualLayout

    Represent the chart manual layout

    Inherited Members
    IParentApplication.Application
    IParentApplication.Parent
    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.Portable.dll
    Syntax
    public interface IChartManualLayout : IParentApplication

    Properties

    Height

    Gets or sets the height/bottom of the chart element as a fraction of height of the chart, based on HeightMode.

    Declaration
    double Height { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of Height 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300; //sets a value of Height for plot area
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.Height = 160; //sets a value of Height for legent area
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20; //sets a value of Height for text area
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    HeightMode

    Gets or sets a value indicating how to interpret the Height of this manual layout. The HeightMode property values are from LayoutModes.

    Declaration
    LayoutModes HeightMode { get; set; }
    Property Value
    Type Description
    LayoutModes
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of HeightMode 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.HeightMode = LayoutModes.edge; //sets a value of Height mode for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.HeightMode = LayoutModes.edge; //sets a value of Height mode for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.HeightMode = LayoutModes.edge; //sets a value of Height mode for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    LayoutTarget

    Gets or sets the layout target for the plot area. The LayoutTarget property values are from LayoutTargets.

    Declaration
    LayoutTargets LayoutTarget { get; set; }
    Property Value
    Type Description
    LayoutTargets
    Remarks

    The layout option LayoutTarget is supported only for plot area. To know more about charts refer this link.

    Examples

    The following code illustrates the use of LayoutTarget 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 target for the plot area
            chart.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner; 
    
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    Left

    Gets or sets the left (x location) of the chart element as a fraction of width of the chart.

    Declaration
    double Left { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    If LeftMode is factor, then the position is relative to the default position for the chart element. To know more about charts refer this link.

    Examples

    The following code illustrates the use of Left 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.Left = 10; //sets a value of left position for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;         
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.Left = 220; //sets a value of left position for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150; //sets a value of left position for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;        
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    LeftMode

    Gets or sets a value indicating how to interpret the Left of this manual layout. The LeftMode property values are from LayoutModes.

    Declaration
    LayoutModes LeftMode { get; set; }
    Property Value
    Type Description
    LayoutModes
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of LeftMode 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"];
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge; //sets a value of Leftmode for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge; //sets a value of Leftmode for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.LeftMode = LayoutModes.edge; //sets a value of Leftmode for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    Top

    Gets or sets the top of the chart element as a fraction of height of the chart.

    Declaration
    double Top { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    If TopMode is factor, then the position is relative to the default position for the chart element. To know more about charts refer this link.

    Examples

    The following code illustrates the use of Top 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.Top = 40; //sets a value of Top position for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;     
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.Top = 30; //sets a value of Top position for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0; //sets a value of Top position for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;      
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    TopMode

    Gets or sets a value indicating how to interpret the Top of this manual layout. The TopMode property values are from LayoutModes.

    Declaration
    LayoutModes TopMode { get; set; }
    Property Value
    Type Description
    LayoutModes
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of TopMode 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.factor; //sets a value of topmode for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.TopMode = LayoutModes.factor; //sets a value of topmode for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.TopMode = LayoutModes.factor; //sets a value of topmode for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    Width

    Gets or sets the width/right of the chart element as a fraction of width of the chart, based on WidthMode.

    Declaration
    double Width { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of Width 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.Width = 430; //sets a value of Width for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;     
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.Width = 120; //sets a value of width for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;         
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220;
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30; //sets a value of Width mode for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;       
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;
            workbook.SaveAs("Charts.xlsx");
            workbook.Close();
          }

    WidthMode

    Gets or sets a value indicating how to interpret the Width of this manual layout. The WidthMode property values are from LayoutModes.

    Declaration
    LayoutModes WidthMode { get; set; }
    Property Value
    Type Description
    LayoutModes
    Remarks

    To know more about charts refer this link.

    Examples

    The following code illustrates the use of WidthMode 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"];  
    
            //Manually positioning plot area
            chart.PlotArea.Layout.ManualLayout.WidthMode = LayoutModes.factor; //sets a value of Width mode for plot area
            chart.PlotArea.Layout.ManualLayout.Height = 300;
            chart.PlotArea.Layout.ManualLayout.Width = 430;
            chart.PlotArea.Layout.ManualLayout.Top = 40;
            chart.PlotArea.Layout.ManualLayout.Left = 10;
    
            //Manually positioning legent area
            chart.Legend.Layout.ManualLayout.WidthMode = LayoutModes.factor; //sets a value of Width mode for legent area
            chart.Legend.Layout.ManualLayout.Height = 160;
            chart.Legend.Layout.ManualLayout.Width = 120;
            chart.Legend.Layout.ManualLayout.Top = 30;
            chart.Legend.Layout.ManualLayout.Left = 220; 
    
            //Manually positioning text Area
            chart.ChartTitleArea.Layout.ManualLayout.WidthMode = LayoutModes.factor; //sets a value of Width mode for text area
            chart.ChartTitleArea.Text = "Sample Chart";
            chart.ChartTitleArea.Layout.ManualLayout.Height = 20;
            chart.ChartTitleArea.Layout.ManualLayout.Width = 30;
            chart.ChartTitleArea.Layout.ManualLayout.Top = 0;
            chart.ChartTitleArea.Layout.ManualLayout.Left = 150;        
            workbook.SaveAs("Charts.xlsx"); 
            workbook.Close();
          }
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved