Class ChartCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates a collection of Aspose.Cells.Charts.Chart objects.
public class ChartCollection : CollectionBase<chart>, IList<chart>, ICollection<chart>, IEnumerable<chart>, ICollection, IEnumerable
Inheritance
object ← CollectionBase<chart> ← ChartCollection
Implements
IList<chart>, ICollection<chart>, IEnumerable<chart>, ICollection, IEnumerable
Inherited Members
CollectionBase<chart>.BinarySearch(Chart), CollectionBase<chart>.BinarySearch(Chart, IComparer<chart>), CollectionBase<chart>.BinarySearch(int, int, Chart, IComparer<chart>), CollectionBase<chart>.Contains(Chart), CollectionBase<chart>.CopyTo(Chart[]), CollectionBase<chart>.CopyTo(Chart[], int), CollectionBase<chart>.CopyTo(int, Chart[], int, int), CollectionBase<chart>.Exists(Predicate<chart>), CollectionBase<chart>.Find(Predicate<chart>), CollectionBase<chart>.FindAll(Predicate<chart>), CollectionBase<chart>.FindIndex(Predicate<chart>), CollectionBase<chart>.FindIndex(int, Predicate<chart>), CollectionBase<chart>.FindIndex(int, int, Predicate<chart>), CollectionBase<chart>.FindLast(Predicate<chart>), CollectionBase<chart>.FindLastIndex(Predicate<chart>), CollectionBase<chart>.FindLastIndex(int, Predicate<chart>), CollectionBase<chart>.FindLastIndex(int, int, Predicate<chart>), CollectionBase<chart>.IndexOf(Chart), CollectionBase<chart>.IndexOf(Chart, int), CollectionBase<chart>.IndexOf(Chart, int, int), CollectionBase<chart>.LastIndexOf(Chart), CollectionBase<chart>.LastIndexOf(Chart, int), CollectionBase<chart>.LastIndexOf(Chart, int, int), CollectionBase<chart>.GetEnumerator(), CollectionBase<chart>.Clear(), CollectionBase<chart>.RemoveAt(int), CollectionBase<chart>.OnClearComplete(), CollectionBase<chart>.OnClear(), CollectionBase<chart>.Capacity, CollectionBase<chart>.Count, CollectionBase<chart>.InnerList, CollectionBase<chart>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
Workbook workbook = new Workbook();
ChartCollection charts = workbook.Worksheets[0].Charts;
Dim workbook as Workbook = new Workbook()
Dim ChartCollection as Charts = workbook.Worksheets(0).Charts
Properties
this[int]
Gets the Aspose.Cells.Charts.Chart element at the specified index.
public Chart this[int index] { get; }
Property Value
this[string]
Gets the chart by the name.
public Chart this[string name] { get; }
Property Value
Remarks
The default chart name is null. So you have to explicitly set the name of the chart.
Methods
Add(ChartType, int, int, int, int)
Adds a chart to the collection.
public int Add(ChartType type, int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)
Parameters
type
ChartType
Chart type
upperLeftRow
int
Upper left row index.
upperLeftColumn
int
Upper left column index.
lowerRightRow
int
Lower right row index
lowerRightColumn
int
Lower right column index
Returns
Aspose.Cells.Charts.Chart object index.
Add(byte[], string, bool, int, int, int, int)
Adds a chart with preset template.
public int Add(byte[] data, string dataRange, bool isVertical, int topRow, int leftColumn, int rightRow, int bottomColumn)
Parameters
data
byte[]
The data of chart template file(.crtx).
dataRange
string
Specifies the data range of the chart
isVertical
bool
Specifies whether to plot the series from a range of cell values by row or by column.
topRow
int
Upper left row index.
leftColumn
int
Upper left column index.
rightRow
int
Lower right row index
bottomColumn
int
Lower right column index
Returns
Aspose.Cells.Charts.Chart object index.
Add(ChartType, string, bool, int, int, int, int)
Adds a chart to the collection.
public int Add(ChartType type, string dataRange, bool isVertical, int topRow, int leftColumn, int rightRow, int bottomColumn)
Parameters
type
ChartType
Chart type
dataRange
string
Specifies the data range of the chart
isVertical
bool
Specifies whether to plot the series from a range of cell values by row or by column.
topRow
int
Upper left row index.
leftColumn
int
Upper left column index.
rightRow
int
Lower right row index
bottomColumn
int
Lower right column index
Returns
Aspose.Cells.Charts.Chart object index.
AddFloatingChart(ChartType, int, int, int, int)
Adds a chart to the collection.
public int AddFloatingChart(ChartType type, int left, int top, int width, int height)
Parameters
type
ChartType
Chart type
left
int
The x offset to corner
top
int
The y offset to corner
width
int
The chart width
height
int
The chart height
Returns
Aspose.Cells.Charts.Chart object index.
Clear()
Clear all charts.
public void Clear()
RemoveAt(int)
Remove a chart at the specific index.
public void RemoveAt(int index)
Parameters
index
int
The chart index. </chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart></chart>