## ChartArea class

Encapsulates the object that represents the chart area in the worksheet.

```csharp
public class ChartArea : ChartFrame
```

## Properties

| Name | Description |
| --- | --- |
| virtual [Area](../../aspose.cells.charts/chartframe/area/) { get; } | Gets the [`area`](../chartframe/area/).(Inherited from [`ChartFrame`](../chartframe/).) |
| virtual [AutoScaleFont](../../aspose.cells.charts/chartframe/autoscalefont/) { get; set; } | True if the text in the object changes font size when the object size changes. The default value is True.(Inherited from [`ChartFrame`](../chartframe/).) |
| [Background](../../aspose.cells.charts/chartframe/background/) { get; set; } | (**Obsolete.**) Gets and sets the display mode of the background. This property is only valid in Excel 2003 or earlier versions.(Inherited from [`ChartFrame`](../chartframe/).) |
| [BackgroundMode](../../aspose.cells.charts/chartframe/backgroundmode/) { get; set; } | (**Obsolete.**) Gets and sets the display mode of the background. This property is only valid in Excel 2003 or earlier versions.(Inherited from [`ChartFrame`](../chartframe/).) |
| virtual [Border](../../aspose.cells.charts/chartframe/border/) { get; } | Gets the [`border`](../../aspose.cells.drawing/line/).(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultHeight](../../aspose.cells.charts/chartframe/defaultheight/) { get; } | (**Obsolete.**) Represents height of the default position in units of 1/4000 of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultHeightRatioToChart](../../aspose.cells.charts/chartframe/defaultheightratiotochart/) { get; } | Represents the height of the default position in units of the fraction of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultWidth](../../aspose.cells.charts/chartframe/defaultwidth/) { get; } | (**Obsolete.**) Represents width of default position in units of 1/4000 of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultWidthRatioToChart](../../aspose.cells.charts/chartframe/defaultwidthratiotochart/) { get; } | Represents width of default position in units of Fraction of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultX](../../aspose.cells.charts/chartframe/defaultx/) { get; } | (**Obsolete.**) Represents x of default position in units of 1/4000 of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultXRatioToChart](../../aspose.cells.charts/chartframe/defaultxratiotochart/) { get; } | Represents x of default position in units of Fraction of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultY](../../aspose.cells.charts/chartframe/defaulty/) { get; } | (**Obsolete.**) Represents the y of the default position in units of 1/4000 of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| [DefaultYRatioToChart](../../aspose.cells.charts/chartframe/defaultyratiotochart/) { get; } | Represents y of the default position in units of the fraction of the chart area.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [Font](../../aspose.cells.charts/chartarea/font/) { get; } | Gets a [`Font`](./font/) object of the specified ChartArea object. |
| override [Height](../../aspose.cells.charts/chartarea/height/) { get; set; } | (**Obsolete.**) Gets or sets the vertical offset from its lower‑right corner row, in units of 1/4000 of the chart area. |
| virtual [HeightPixel](../../aspose.cells.charts/chartframe/heightpixel/) { get; set; } | Gets or sets the height of the frame in units of pixels.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [HeightRatioToChart](../../aspose.cells.charts/chartarea/heightratiotochart/) { get; set; } | Gets or sets the vertical offset from its lower right corner row, in units of ratio of the chart area. |
| virtual [IsAutomaticSize](../../aspose.cells.charts/chartframe/isautomaticsize/) { get; set; } | Indicates whether the chart frame is automatic sized.(Inherited from [`ChartFrame`](../chartframe/).) |
| [IsDefaultPosBeSet](../../aspose.cells.charts/chartframe/isdefaultposbeset/) { get; } | Indicates whether the default position (DefaultX, DefaultY, DefaultWidth and DefaultHeight) is set.(Inherited from [`ChartFrame`](../chartframe/).) |
| [IsInnerMode](../../aspose.cells.charts/chartframe/isinnermode/) { get; set; } | Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.(Inherited from [`ChartFrame`](../chartframe/).) |
| [Shadow](../../aspose.cells.charts/chartframe/shadow/) { get; set; } | True if the frame has a shadow.(Inherited from [`ChartFrame`](../chartframe/).) |
| [ShapeProperties](../../aspose.cells.charts/chartframe/shapeproperties/) { get; } | Gets the [`ShapeProperties`](../chartframe/shapeproperties/) object.(Inherited from [`ChartFrame`](../chartframe/).) |
| virtual [TextFont](../../aspose.cells.charts/chartframe/textfont/) { get; } | (**Obsolete.**) Gets a [`Font`](../chartframe/font/) object of the specified ChartFrame object.(Inherited from [`ChartFrame`](../chartframe/).) |
| virtual [TextOptions](../../aspose.cells.charts/chartframe/textoptions/) { get; } | Gets and sets the options of the text.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [Width](../../aspose.cells.charts/chartarea/width/) { get; set; } | (**Obsolete.**) Gets or sets the horizontal offset from its lower right corner column, in units of 1/4000 of the chart area. |
| virtual [WidthPixel](../../aspose.cells.charts/chartframe/widthpixel/) { get; set; } | Gets or sets the width of frame in units of Pixel.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [WidthRatioToChart](../../aspose.cells.charts/chartarea/widthratiotochart/) { get; set; } | Gets or sets the horizontal offset from its lower right corner column, in units of ratio of the chart area. |
| override [X](../../aspose.cells.charts/chartarea/x/) { get; set; } | (**Obsolete.**) Gets or sets the horizontal offset from its upper-left corner column, in units of 1/4000 of the chart area. |
| virtual [XPixel](../../aspose.cells.charts/chartframe/xpixel/) { get; set; } | Gets or sets the x coordinate of the upper left corner in units of Pixel.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [XRatioToChart](../../aspose.cells.charts/chartarea/xratiotochart/) { get; set; } | Gets or sets the horizontal offset from the upper-left corner column, as a ratio of the chart area. |
| override [Y](../../aspose.cells.charts/chartarea/y/) { get; set; } | (**Obsolete.**) Gets or gets the vertical offset from its upper left corner row, in units of 1/4000 of the chart area. |
| virtual [YPixel](../../aspose.cells.charts/chartframe/ypixel/) { get; set; } | Gets or sets the y coordinate of the upper left corner in units of pixels.(Inherited from [`ChartFrame`](../chartframe/).) |
| override [YRatioToChart](../../aspose.cells.charts/chartarea/yratiotochart/) { get; set; } | Gets or gets the vertical offset from its upper left corner row, in units of ratio of the chart area. |

## Methods

| Name | Description |
| --- | --- |
| virtual [SetPositionAuto](../../aspose.cells.charts/chartframe/setpositionauto/)() | Set position of the frame to automatic(Inherited from [`ChartFrame`](../chartframe/).) |

### Examples

```csharp
namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Charts;
    using System;
    using System.Drawing;

    public class ChartAreaDemo
    {
        public static void ChartAreaExample()
        {
            // Instantiating a Workbook object
            Workbook workbook = new Workbook();

            // Obtaining the reference of the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Adding a sample value to "A1" cell
            worksheet.Cells["A1"].PutValue(50);

            // Adding a sample value to "A2" cell
            worksheet.Cells["A2"].PutValue(100);

            // Adding a sample value to "A3" cell
            worksheet.Cells["A3"].PutValue(150);

            // Adding a sample value to "B1" cell
            worksheet.Cells["B1"].PutValue(60);

            // Adding a sample value to "B2" cell
            worksheet.Cells["B2"].PutValue(32);

            // Adding a sample value to "B3" cell
            worksheet.Cells["B3"].PutValue(50);

            // Adding a chart to the worksheet
            int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);

            // Accessing the instance of the newly added chart
            Chart chart = worksheet.Charts[chartIndex];

            // Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
            chart.NSeries.Add("A1:B3", true);

            // Getting Chart Area
            ChartArea chartArea = chart.ChartArea;

            // Setting properties of ChartArea
            chartArea.X = 10;
            chartArea.Y = 10;
            chartArea.Width = 400;
            chartArea.Height = 300;
            chartArea.IsInnerMode = false;
            chartArea.AutoScaleFont = true;
            chartArea.BackgroundMode = BackgroundMode.Transparent;
            chartArea.IsAutomaticSize = true;
            chartArea.Shadow = true;

            // Setting the foreground color of the chart area
            chartArea.Area.ForegroundColor = Color.Yellow;

            // Saving the Excel file
            workbook.Save("ChartAreaExample.xlsx");
            workbook.Save("ChartAreaExample.pdf");
        }
    }
}
```

### See Also

* class [ChartFrame](../chartframe/)
* namespace [Aspose.Cells.Charts](../../aspose.cells.charts/)
* assembly [Aspose.Cells](../../)


