Class Series
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates the object that represents a single data series in a chart.
public class Series
Inheritance
Inherited Members
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"
int seriesIndex = chart.NSeries.Add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.NSeries.CategoryData = "C1:C4";
Series series = chart.NSeries[seriesIndex];
//Setting the values of the series.
series.Values = "=B1:B4";
//Changing the chart type of the series.
series.Type = ChartType.Line;
//Setting marker properties.
series.Marker.MarkerStyle = ChartMarkerType.Circle;
series.Marker.ForegroundColorSetType = FormattingType.Automatic;
series.Marker.ForegroundColor = System.Drawing.Color.Black;
series.Marker.BackgroundColorSetType = FormattingType.Automatic;
//do your business
//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 Int32 = 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 Int32 = 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"
Dim seriesIndex As Int32 = chart.NSeries.Add("A1:B4", True)
'Setting the data source for the category data of NSeries
chart.NSeries.CategoryData = "C1:C4"
Dim series As Series = chart.NSeries(seriesIndex)
'Setting the values of the series.
series.Values = "=B1:B4"
'Changing the chart type of the series.
series.Type = ChartType.Line
'Setting marker properties.
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("book1.xls")
Properties
Area
Represents the background area of Series object.
public Area Area { get; }
Property Value
Bar3DShapeType
Gets or sets the 3D shape type used with the 3-D bar or column chart.
public Bar3DShapeType Bar3DShapeType { get; set; }
Property Value
Border
Represents border of Series object.
public Line Border { get; }
Property Value
BubbleScale
Gets or sets the scale factor for bubbles in the specified chart group. It can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts.
public int BubbleScale { get; set; }
Property Value
BubbleSizes
Gets or sets the bubble sizes values of the chart series.
public string BubbleSizes { get; set; }
Property Value
CountOfDataValues
Gets the number of the data values.
public int CountOfDataValues { get; }
Property Value
DataLabels
Represents the DataLabels object for the specified ASeries.
public DataLabels DataLabels { get; }
Property Value
DisplayName
Gets the series’s name that displays on the chart graph.
public string DisplayName { get; }
Property Value
DoughnutHoleSize
Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent.
public int DoughnutHoleSize { get; set; }
Property Value
DownBars
Returns a Aspose.Cells.Charts.DropBars object that represents the down bars on a line chart. Applies only to line charts.
public DropBars DownBars { get; }
Property Value
DropLines
Returns a Aspose.Cells.Drawing.Line object that represents the drop lines for a series on the line chart or area chart. Applies only to line chart or area charts.
public Line DropLines { get; }
Property Value
Explosion
The distance of an open pie slice from the center of the pie chart is expressed as a percentage of the pie diameter.
public int Explosion { get; set; }
Property Value
FirstSliceAngle
Gets or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360.
public short FirstSliceAngle { get; set; }
Property Value
GapWidth
Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500.
public short GapWidth { get; set; }
Property Value
Has3DEffect
True if the series has a three-dimensional appearance. Applies only to bubble charts.
public bool Has3DEffect { get; set; }
Property Value
HasDropLines
True if the chart has drop lines. Applies only to line chart or area charts.
public bool HasDropLines { get; set; }
Property Value
HasHiLoLines
True if the line chart has high-low lines. Applies only to line charts.
public bool HasHiLoLines { get; set; }
Property Value
HasLeaderLines
True if the series has leader lines.
public bool HasLeaderLines { get; set; }
Property Value
HasRadarAxisLabels
True if a radar chart has category axis labels. Applies only to radar charts.
public bool HasRadarAxisLabels { get; set; }
Property Value
HasSeriesLines
True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to stacked column charts, bar charts, Pie of Pie charts, or Bar of Pie charts.
public bool HasSeriesLines { get; set; }
Property Value
HasUpDownBars
True if a line chart has up and down bars. Applies only to line charts.
public bool HasUpDownBars { get; set; }
Property Value
HiLoLines
Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts.
public Line HiLoLines { get; }
Property Value
IsAutoSplit
Indicates whether the threshold value is automatic.
public bool IsAutoSplit { get; }
Property Value
IsColorVaried
Represents if the color of points is varied. The chart must contain only one series.
public bool IsColorVaried { get; set; }
Property Value
IsFiltered
Indicates whether the series is selected or filtered.True represents this series is filtered, and it will not be displayed on the chart.
public bool IsFiltered { get; set; }
Property Value
IsVerticalValues
Indicates whether the data source is vertical.
public bool IsVerticalValues { get; }
Property Value
LayoutProperties
Represents the properties of layout.
public SeriesLayoutProperties LayoutProperties { get; }
Property Value
LeaderLines
Represents leader lines on a chart. Leader lines connect data labels to data points. This object isn’t a collection; there’s no object that represents a single leader line.
public Line LeaderLines { get; }
Property Value
LegendEntry
Gets the legend entry according to this series.
public LegendEntry LegendEntry { get; }
Property Value
Marker
Gets the Aspose.Cells.Charts.Series.Marker?text=marker.
public Marker Marker { get; }
Property Value
Name
Gets or sets the name of the data series.
public string Name { get; set; }
Property Value
Examples
//Reference name to a cell
chart.NSeries[0].Name = "=A1";
//Set a string to name
chart.NSeries[0].Name = "First Series";
'Reference name to a cell
chart.NSeries[0].Name = "=A1"
'Set a string to name
chart.NSeries[0].Name = "First Series"
Overlap
Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts.
public short Overlap { get; set; }
Property Value
PlotOnSecondAxis
Indicates if this series is plotted on second value axis.
public bool PlotOnSecondAxis { get; set; }
Property Value
Points
Gets the collection of points in a series in a chart.
public ChartPointCollection Points { get; }
Property Value
Remarks
When the chart is Pie of Pie or Bar of Pie, the last point is other point in first pie plot.
SecondPlotSize
Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200.
public short SecondPlotSize { get; set; }
Property Value
SeriesLines
Returns a SeriesLines object that represents the series lines for a stacked bar chart or a stacked column chart. Applies only to stacked bar and stacked column charts.
public Line SeriesLines { get; }
Property Value
Shadow
True if the series has a shadow.
public bool Shadow { get; set; }
Property Value
ShapeProperties
Gets the Aspose.Cells.Drawing.ShapePropertyCollection object that holds the visual shape properties of the Series.
public ShapePropertyCollection ShapeProperties { get; }
Property Value
ShowNegativeBubbles
True if negative bubbles are shown for the chart group. Valid only for bubble charts.
public bool ShowNegativeBubbles { get; set; }
Property Value
SizeRepresents
Gets or sets what the bubble size represents on a bubble chart.
public BubbleSizeRepresents SizeRepresents { get; set; }
Property Value
Remarks
BubbleSizeRepresents.SizeIsArea means the value Aspose.Cells.Charts.Series.BubbleSizes is the area of the bubble. BubbleSizeRepresents.SizeIsWidth means the value Aspose.Cells.Charts.Series.BubbleSizes is the width of the bubble.
Smooth
Represents curve smoothing. True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter connected by lines charts.
public bool Smooth { get; set; }
Property Value
SplitType
Returns or sets a value that how to determine which data points are in the second pie or bar on a pie of pie or bar of pie chart.
public ChartSplitType SplitType { get; set; }
Property Value
SplitValue
Returns or sets a value that shall be used to determine which data points are in the second pie or bar on a pie of pie or bar of pie chart.
public double SplitValue { get; set; }
Property Value
TrendLines
Returns all the trendlines of this series.
public TrendlineCollection TrendLines { get; }
Property Value
Type
Gets or sets a data series’ type.
public ChartType Type { get; set; }
Property Value
UpBars
Returns an DropBars object that represents the up bars on a line chart. Applies only to line charts.
public DropBars UpBars { get; }
Property Value
Values
Represents the Y values of this chart series.
public string Values { get; set; }
Property Value
ValuesFormatCode
Represents format code of Values’s NumberList.
public string ValuesFormatCode { get; set; }
Property Value
XErrorBar
Represents X direction error bar of the series.
public ErrorBar XErrorBar { get; }
Property Value
XValues
Represents the x values of the chart series.
public string XValues { get; set; }
Property Value
XValuesFormatCode
Represents format code of X Values’s NumberList.
public string XValuesFormatCode { get; set; }
Property Value
YErrorBar
Represents Y direction error bar of the series.
public ErrorBar YErrorBar { get; }
Property Value
Methods
Move(int)
Moves the series up or down.
public void Move(int count)
Parameters
count
int
The number of moving up or down. Move the series up if this is less than zero; Move the series down if this is greater than zero.