Class ChartArea

Class ChartArea

Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)

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

public class ChartArea : ChartFrame

Inheritance

objectChartFrameChartArea

Inherited Members

ChartFrame.m_IsAutoXPos, ChartFrame.m_IsAutoYPos, ChartFrame.m_IsOffsetPosBeSet, ChartFrame.m_fontIndex, ChartFrame.m_AutoScaleFont, ChartFrame.m_BackgroundMode, ChartFrame.m_isAutoSize, ChartFrame.SetPositionAuto(), ChartFrame.IsInnerMode, ChartFrame.Border, ChartFrame.Area, ChartFrame.TextOptions, ChartFrame.Font, ChartFrame.AutoScaleFont, ChartFrame.BackgroundMode, ChartFrame.IsAutomaticSize, ChartFrame.X, ChartFrame.Y, ChartFrame.Height, ChartFrame.Width, ChartFrame.Shadow, ChartFrame.ShapeProperties, ChartFrame.IsDefaultPosBeSet, ChartFrame.DefaultX, ChartFrame.DefaultY, ChartFrame.DefaultWidth, ChartFrame.DefaultHeight, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[C#]

//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 the foreground color of the chart area
chartArea.Area.ForegroundColor = Color.Yellow;

//Setting Chart Area Shadow
chartArea.Shadow = true;

//Saving the Excel file
workbook.Save("book1.xls");

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()

'Obtaining the reference of the first worksheet
Dim worksheet As 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
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)

'Accessing the instance of the newly added chart
Dim chart As 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
Dim chartArea As ChartArea = chart.ChartArea

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

'Setting Chart Area Shadow
chartArea.Shadow = True

'Saving the Excel file
workbook.Save("book1.xls")

Properties

Font

Gets a Aspose.Cells.Charts.ChartArea.Font object of the specified chartarea object.

public override Font Font { get; }

Property Value

Font

Height

Gets or sets the vertical offset from its lower right corner row.

public override int Height { get; set; }

Property Value

int

Width

Gets or sets the horizontal offset from its lower right corner column.

public override int Width { get; set; }

Property Value

int

X

Gets or gets the horizontal offset from its upper left corner column.

public override int X { get; set; }

Property Value

int

Y

Gets or gets the vertical offset from its upper left corner row.

public override int Y { get; set; }

Property Value

int