Class SeriesCollection
Contents
[
Hide
]SeriesCollection class
Encapsulates a collection of Series
objects.
public class SeriesCollection : CollectionBase<Series>
Properties
Name | Description |
---|---|
Capacity { get; set; } | |
CategoryData { get; set; } | 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}"). |
Count { get; } | |
IsColorVaried { get; set; } | Represents if the color of points is varied. |
Item { get; } | Gets the Series element at the specified index. |
Item { get; set; } | |
SecondCategoryData { get; set; } | 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. |
Methods
Name | Description |
---|---|
Add(string, bool) | Adds the Series collection to a chart. |
Add(string, bool, bool) | Adds the Series collection to a chart. |
AddR1C1(string, bool) | Adds the Series collection to a chart. |
BinarySearch(Series) | |
BinarySearch(Series, IComparer<Series>) | |
BinarySearch(int, int, Series, IComparer<Series>) | |
ChangeColors(ChartColorPaletteType) | Set Monochromatic Palette for chart series. |
ChangeSeriesOrder(int, int) | (Obsolete.) Directly changes the orders of the two series. |
Clear() | Clears the collection (2 methods) |
Contains(Series) | |
CopyTo(Series[]) | |
CopyTo(Series[], int) | |
CopyTo(int, Series[], int, int) | |
Exists(Predicate<Series>) | |
Find(Predicate<Series>) | |
FindAll(Predicate<Series>) | |
FindIndex(Predicate<Series>) | |
FindIndex(int, Predicate<Series>) | |
FindIndex(int, int, Predicate<Series>) | |
FindLast(Predicate<Series>) | |
FindLastIndex(Predicate<Series>) | |
FindLastIndex(int, Predicate<Series>) | |
FindLastIndex(int, int, Predicate<Series>) | |
GetEnumerator() | |
GetSeriesByOrder(int) | Gets the Series element by order. |
IndexOf(Series) | |
IndexOf(Series, int) | |
IndexOf(Series, int, int) | |
LastIndexOf(Series) | |
LastIndexOf(Series, int) | |
LastIndexOf(Series, int, int) | |
RemoveAt(int) | Remove at a series at the specific index. (2 methods) |
SetSeriesNames(int, string, bool) | Sets the name of all the serieses in the chart. |
SwapSeries(int, int) | Directly changes the orders of the two series. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Charts;
using System;
public class SeriesCollectionDemo
{
public static void SeriesCollectionExample()
{
// 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 sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["A4"].PutValue(200);
worksheet.Cells["B1"].PutValue(60);
worksheet.Cells["B2"].PutValue(32);
worksheet.Cells["B3"].PutValue(50);
worksheet.Cells["B4"].PutValue(40);
worksheet.Cells["C1"].PutValue("Q1");
worksheet.Cells["C2"].PutValue("Q2");
worksheet.Cells["C3"].PutValue("Y1");
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";
// Accessing the SeriesCollection of the chart
SeriesCollection seriesCollection = chart.NSeries;
// Setting properties of the SeriesCollection
seriesCollection.CategoryData = "C1:C4";
seriesCollection.SecondCategoryData = "C1:C4";
seriesCollection.IsColorVaried = true;
// Accessing a specific series in the SeriesCollection
Series series = seriesCollection[0];
// Setting properties of the series
series.Values = "=B1:B4";
series.Name = "First Series";
series.Type = ChartType.Line;
series.Marker.MarkerStyle = ChartMarkerType.Circle;
series.Marker.ForegroundColorSetType = FormattingType.Automatic;
series.Marker.ForegroundColor = System.Drawing.Color.Black;
series.Marker.BackgroundColorSetType = FormattingType.Automatic;
// Saving the Excel file
workbook.Save("SeriesCollectionExample.xlsx");
}
}
}
See Also
- class CollectionBase<T>
- class Series
- namespace Aspose.Cells.Charts
- assembly Aspose.Cells