Class SeriesCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates a collection of Aspose.Cells.Charts.Series objects.
public class SeriesCollection : CollectionBase<series>, IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable
Inheritance
object ← CollectionBase<series> ← SeriesCollection
Implements
IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable
Inherited Members
CollectionBase<series>.BinarySearch(Series), CollectionBase<series>.BinarySearch(Series, IComparer<series>), CollectionBase<series>.BinarySearch(int, int, Series, IComparer<series>), CollectionBase<series>.Contains(Series), CollectionBase<series>.CopyTo(Series[]), CollectionBase<series>.CopyTo(Series[], int), CollectionBase<series>.CopyTo(int, Series[], int, int), CollectionBase<series>.Exists(Predicate<series>), CollectionBase<series>.Find(Predicate<series>), CollectionBase<series>.FindAll(Predicate<series>), CollectionBase<series>.FindIndex(Predicate<series>), CollectionBase<series>.FindIndex(int, Predicate<series>), CollectionBase<series>.FindIndex(int, int, Predicate<series>), CollectionBase<series>.FindLast(Predicate<series>), CollectionBase<series>.FindLastIndex(Predicate<series>), CollectionBase<series>.FindLastIndex(int, Predicate<series>), CollectionBase<series>.FindLastIndex(int, int, Predicate<series>), CollectionBase<series>.IndexOf(Series), CollectionBase<series>.IndexOf(Series, int), CollectionBase<series>.IndexOf(Series, int, int), CollectionBase<series>.LastIndexOf(Series), CollectionBase<series>.LastIndexOf(Series, int), CollectionBase<series>.LastIndexOf(Series, int, int), CollectionBase<series>.GetEnumerator(), CollectionBase<series>.Clear(), CollectionBase<series>.RemoveAt(int), CollectionBase<series>.OnClearComplete(), CollectionBase<series>.OnClear(), CollectionBase<series>.Capacity, CollectionBase<series>.Count, CollectionBase<series>.InnerList, CollectionBase<series>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//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 "A4" cell
worksheet.Cells["A4"].PutValue(200);
//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 sample value to "B4" cell
worksheet.Cells["B4"].PutValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.Cells["C1"].PutValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.Cells["C2"].PutValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.Cells["C3"].PutValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.Cells["C4"].PutValue("Y2");
//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 "B4"
chart.NSeries.Add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.NSeries.CategoryData = "C1:C4";
//Saving the Excel file
workbook.Save("book1.xls");
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Adding a new worksheet to the Excel object
Dim sheetIndex As Integer = workbook.Worksheets.Add()
'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'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 "A4" cell
worksheet.Cells("A4").PutValue(200)
'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 sample value to "B4" cell
worksheet.Cells("B4").PutValue(40)
'Adding a sample value to "C1" cell as category data
worksheet.Cells("C1").PutValue("Q1")
'Adding a sample value to "C2" cell as category data
worksheet.Cells("C2").PutValue("Q2")
'Adding a sample value to "C3" cell as category data
worksheet.Cells("C3").PutValue("Y1")
'Adding a sample value to "C4" cell as category data
worksheet.Cells("C4").PutValue("Y2")
'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 "B4"
chart.NSeries.Add("A1:B4", True)
'Setting the data source for the category data of NSeries
chart.NSeries.CategoryData = "C1:C4"
'Saving the Excel file
workbook.Save("book1.xls")
Properties
CategoryData
Gets or sets the range of category Axis values. It can be a range of cells (such as, “d1:e10”), or a sequence of values (such as,"{2,6,8,10}").
public string CategoryData { get; set; }
Property Value
IsColorVaried
Represents if the color of points is varied.
public bool IsColorVaried { get; set; }
Property Value
SecondCategoryData
Gets or sets the range of second category Axis values. It can be a range of cells (such as, “d1:e10”), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis.
public string SecondCategoryData { get; set; }
Property Value
this[int]
Gets the Aspose.Cells.Charts.Series element at the specified index.
public Series this[int index] { get; }
Property Value
Methods
Add(string, bool)
Adds the Aspose.Cells.Charts.Series collection to a chart.
public int Add(string area, bool isVertical)
Parameters
area
string
Specifies values from which to plot the data series
isVertical
bool
Specifies whether to plot the series from a range of cell values by row or by column.
Returns
Return the first index of the added ASeries in the NSeries.
Remarks
If set data on contiguous cells, use colon to seperate them.For example, $C$2:$C$5.
If set data on non contiguous cells, use comma to seperate them.For example: ($C$2,$D$5).
Add(string, bool, bool)
Adds the Aspose.Cells.Charts.Series collection to a chart.
public int Add(string area, bool isVertical, bool checkLabels)
Parameters
area
string
Specifies values from which to plot the data series
isVertical
bool
Specifies whether to plot the series from a range of cell values by row or by column.
checkLabels
bool
Indicates whether the range contains series’s name
Returns
Return the first index of the added ASeries in the NSeries.
Remarks
If set data on contiguous cells, use colon to seperate them.For example, $C$2:$C$5.
If set data on non contiguous cells, use comma to seperate them.For example, ($C$2,$D$5).
AddR1C1(string, bool)
Adds the Aspose.Cells.Charts.Series collection to a chart.
public int AddR1C1(string area, bool isVertical)
Parameters
area
string
Specifies values from which to plot the data series
isVertical
bool
Specifies whether to plot the series from a range of cell values by row or by column.
Returns
Return the first index of the added ASeries in the NSeries.
Remarks
If set data on contiguous cells, use colon to seperate them.For example, R[1]C[1]:R[3]C[2].
If set data on contiguous cells, use comma to seperate them.For example,(R[1]C[1],R[3]C[2]).
Clear()
Clears the collection
public void Clear()
GetSeriesByOrder(int)
Gets the Aspose.Cells.Charts.Series element by order.
public Series GetSeriesByOrder(int order)
Parameters
order
int
The order of series
Returns
The element series
RemoveAt(int)
Remove at a series at the specific index.
public void RemoveAt(int index)
Parameters
index
int
The index.
SetSeriesNames(int, string, bool)
Sets the name of all the serieses in the chart.
public void SetSeriesNames(int startIndex, string area, bool isVertical)
Parameters
startIndex
int
The index of the first series which you want to set the name.
area
string
Specifies the area for the series name.
isVertical
bool
>Specifies whether to plot the series from a range of cell values by row or by column.
Remarks
If the start index is larger than the count of the serieses, it will return and do nothing.
If set data on contiguous cells, use colon to seperate them.For example, $C$2:$C$5.
If set data on contiguous cells, use comma to seperate them.For example, ($C$2,$D$5).
SwapSeries(int, int)
Directly changes the orders of the two series.
public void SwapSeries(int sourceIndex, int destIndex)
Parameters
sourceIndex
int
The current index
destIndex
int
The dest index </series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series></series>