Class ChartShape

Class ChartShape

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

Represents the shape of the chart. Properties and methods for the ChartObject object control the appearance and size of the embedded chart on the worksheet.

public class ChartShape : Shape

Inheritance

objectShapeChartShape

Inherited Members

Shape.GetResultOfSmartArt(), Shape.ToFrontOrBack(int), Shape.GetLockedProperty(ShapeLockType), Shape.SetLockedProperty(ShapeLockType, bool), Shape.AddHyperlink(string), Shape.RemoveHyperlink(), Shape.MoveToRange(int, int, int, int), Shape.AlignTopRightCorner(int, int), Shape.GetConnectionPoints(), Shape.ToImage(Stream, ImageType), Shape.ToImage(string, ImageOrPrintOptions), Shape.ToImage(Stream, ImageOrPrintOptions), Shape.GetLinkedCell(bool, bool), Shape.SetLinkedCell(string, bool, bool), Shape.GetInputRange(bool, bool), Shape.SetInputRange(string, bool, bool), Shape.UpdateSelectedValue(), Shape.CalculateTextSize(), Shape.FormatCharacters(int, int, Font, StyleFlag), Shape.Characters(int, int), Shape.GetRichFormattings(), Shape.RemoveActiveXControl(), Shape.IsSameSetting(object), Shape.GetActualBox(), Shape.MacroName, Shape.IsEquation, Shape.IsSmartArt, Shape.ZOrderPosition, Shape.Name, Shape.AlternativeText, Shape.Title, Shape.Line, Shape.Fill, Shape.ShadowEffect, Shape.Reflection, Shape.Glow, Shape.SoftEdges, Shape.ThreeDFormat, Shape.FormatPicture, Shape.IsHidden, Shape.IsAspectRatioLocked, Shape.RotationAngle, Shape.Hyperlink, Shape.Id, Shape.Spid, Shape.Spt, Shape.Worksheet, Shape.IsGroup, Shape.IsInGroup, Shape.IsWordArt, Shape.TextEffect, Shape.IsLocked, Shape.IsPrintable, Shape.MsoDrawingType, Shape.AutoShapeType, Shape.AnchorType, Shape.Placement, Shape.UpperLeftRow, Shape.UpperDeltaY, Shape.UpperLeftColumn, Shape.UpperDeltaX, Shape.LowerRightRow, Shape.LowerDeltaY, Shape.LowerRightColumn, Shape.LowerDeltaX, Shape.Right, Shape.Bottom, Shape.Width, Shape.WidthInch, Shape.WidthPt, Shape.WidthCM, Shape.Height, Shape.HeightInch, Shape.HeightPt, Shape.HeightCM, Shape.Left, Shape.LeftInch, Shape.LeftCM, Shape.Top, Shape.TopInch, Shape.TopCM, Shape.TopToCorner, Shape.LeftToCorner, Shape.X, Shape.Y, Shape.WidthScale, Shape.HeightScale, Shape.TopInShape, Shape.LeftInShape, Shape.WidthInShape, Shape.HeightInShape, Shape.Group, Shape.Type, Shape.HasLine, Shape.IsFilled, Shape.IsFlippedHorizontally, Shape.IsFlippedVertically, Shape.ActualLowerRightRow, Shape.RelativeToOriginalPictureSize, Shape.LinkedCell, Shape.InputRange, Shape.TextShapeType, Shape.TextBody, Shape.Font, Shape.TextOptions, Shape.Text, Shape.IsRichText, Shape.HtmlText, Shape.TextVerticalOverflow, Shape.TextHorizontalOverflow, Shape.IsTextWrapped, Shape.TextOrientationType, Shape.TextHorizontalAlignment, Shape.TextVerticalAlignment, Shape.TextDirection, Shape.TextBoxOptions, Shape.ControlData, Shape.ActiveXControl, Shape.Paths, Shape.Geometry, Shape.CreateId, Shape.IsDecorative, 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.PieExploded, 5, 0, 25, 10);

//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);

//Show Data Labels 
chart.NSeries[0].DataLabels.ShowValue = true;

//Getting Chart Shape
ChartShape chartShape = chart.ChartObject;

//Set Lower Right Column
chartShape.LowerRightColumn = 10;

//Set LowerDeltaX
chartShape.LowerDeltaX = 1024;

//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.PieExploded, 5, 0, 25, 10)

'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)

'Show Data Labels 
chart.NSeries(0).DataLabels.ShowValue = True

'Getting Chart Shape
Dim chartShape As ChartShape = chart.ChartObject

'Set Lower Right Column
chartShape.LowerRightColumn = 10

'Set LowerDeltaX
chartShape.LowerDeltaX = 1024

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

Properties

Chart

Returns a Chart object that represents the chart contained in the object.

public Chart Chart { get; }

Property Value

Chart