Series

Series class

Encapsulates the object that represents a single data series in a chart.

class Series;

Example

const { Workbook, ChartType, ChartMarkerType, FormattingType, Color, SaveFormat } = AsposeCells;

//Instantiating a Workbook object
var workbook = new Workbook();
//Adding a new worksheet to the Excel object
var sheetIndex = workbook.worksheets.add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.worksheets.get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.cells.get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.cells.get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.cells.get("A3").putValue(150);
//Adding a sample value to "A4" cell
worksheet.cells.get("A4").putValue(200);
//Adding a sample value to "B1" cell
worksheet.cells.get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.cells.get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.cells.get("B3").putValue(50);
//Adding a sample value to "B4" cell
worksheet.cells.get("B4").putValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.cells.get("C1").putValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.cells.get("C2").putValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.cells.get("C3").putValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.cells.get("C4").putValue("Y2");
//Adding a chart to the worksheet
var chartIndex = worksheet.charts.add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
var chart = worksheet.charts.get(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";
var series = chart.nSeries.get(1);
//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 = Color.Black;
series.marker.backgroundColorSetType = FormattingType.Automatic;
//Saving the Excel file
var uint8Array = workbook.save(SaveFormat.Xlsx);

Properties

PropertyTypeDescription
isFilteredbooleanIndicates whether the series is selected or filtered.True represents this series is filtered, and it will not be displayed on the chart.
layoutPropertiesSeriesLayoutPropertiesReadonly. Represents the properties of layout.
pointsChartPointCollectionReadonly. Gets the collection of points in a series in a chart.
areaAreaReadonly. Represents the background area of Series object.
borderLineReadonly. Represents border of Series object.
namestringGets or sets the name of the data series.
displayNamestringReadonly. Gets the series’s name that displays on the chart graph.
countOfDataValuesnumberReadonly. Gets the number of the data values.
isVerticalValuesbooleanReadonly. Indicates whether the data source is vertical.
valuesstringRepresents the Y values of this chart series.
valuesFormatCodestringRepresents format code of Values’s NumberList.
xValuesFormatCodestringRepresents format code of X Values’s NumberList.
xValuesstringRepresents the x values of the chart series.
bubbleSizesstringGets or sets the bubble sizes values of the chart series.
trendLinesTrendlineCollectionReadonly. Returns all the trendlines of this series.
smoothbooleanRepresents 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.
shadowbooleanTrue if the series has a shadow.
has3DEffectbooleanTrue if the series has a three-dimensional appearance. Applies only to bubble charts.
bar3DShapeTypeBar3DShapeTypeGets or sets the 3D shape type used with the 3-D bar or column chart.
dataLabelsDataLabelsReadonly. Represents the DataLabels object for the specified ASeries.
typeChartTypeGets or sets a data series’ type.
markerMarkerReadonly. Gets the marker.
plotOnSecondAxisbooleanIndicates if this series is plotted on second value axis.
xErrorBarErrorBarReadonly. Represents X direction error bar of the series.
yErrorBarErrorBarReadonly. Represents Y direction error bar of the series.
hasHiLoLinesbooleanTrue if the line chart has high-low lines. Applies only to line charts.
hiLoLinesLineReadonly. Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts.
hasSeriesLinesbooleanTrue 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.
seriesLinesLineReadonly. 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.
hasDropLinesbooleanTrue if the chart has drop lines. Applies only to line chart or area charts.
dropLinesLineReadonly. Returns a 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.
hasUpDownBarsbooleanTrue if a line chart has up and down bars. Applies only to line charts.
upBarsDropBarsReadonly. Returns an DropBars object that represents the up bars on a line chart. Applies only to line charts.
downBarsDropBarsReadonly. Returns a DropBars object that represents the down bars on a line chart. Applies only to line charts.
isColorVariedbooleanRepresents if the color of points is varied. The chart must contain only one series.
gapWidthnumberReturns 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.
firstSliceAnglenumberGets 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.
overlapnumberSpecifies 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.
secondPlotSizenumberReturns 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.
splitTypeChartSplitTypeReturns 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.
splitValuenumberReturns 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.
isAutoSplitbooleanReadonly. Indicates whether the threshold value is automatic.
bubbleScalenumberGets 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.
sizeRepresentsBubbleSizeRepresentsGets or sets what the bubble size represents on a bubble chart.
showNegativeBubblesbooleanTrue if negative bubbles are shown for the chart group. Valid only for bubble charts.
doughnutHoleSizenumberReturns 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.
explosionnumberThe distance of an open pie slice from the center of the pie chart is expressed as a percentage of the pie diameter.
hasRadarAxisLabelsbooleanTrue if a radar chart has category axis labels. Applies only to radar charts.
hasLeaderLinesbooleanTrue if the series has leader lines.
leaderLinesLineReadonly. 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.
legendEntryLegendEntryReadonly. Gets the legend entry according to this series.
shapePropertiesShapePropertyCollectionReadonly. Gets the ShapePropertyCollection object that holds the visual shape properties of the Series.

Methods

MethodDescription
move(number)Moves the series up or down.

isFiltered

Indicates whether the series is selected or filtered.True represents this series is filtered, and it will not be displayed on the chart.

isFiltered : boolean;

layoutProperties

Readonly. Represents the properties of layout.

layoutProperties : SeriesLayoutProperties;

points

Readonly. Gets the collection of points in a series in a chart.

points : ChartPointCollection;

Remarks

When the chart is Pie of Pie or Bar of Pie, the last point is other point in first pie plot.

area

Readonly. Represents the background area of Series object.

area : Area;

border

Readonly. Represents border of Series object.

border : Line;

name

Gets or sets the name of the data series.

name : string;

Example

const { Workbook, ChartType } = AsposeCells;

var workbook = new Workbook();
//Get the first worksheet.
var worksheet = workbook.worksheets.get(0);
//Adding a chart to the worksheet
var chartIndex = worksheet.charts.add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
var chart = worksheet.charts.get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.nSeries.add("A1:B4", true);
//Reference name to a cell
chart.nSeries.get(0).name = "=A1";
//Set a string to name
chart.nSeries.get(0).name = "First Series";

displayName

Readonly. Gets the series’s name that displays on the chart graph.

displayName : string;

countOfDataValues

Readonly. Gets the number of the data values.

countOfDataValues : number;

isVerticalValues

Readonly. Indicates whether the data source is vertical.

isVerticalValues : boolean;

values

Represents the Y values of this chart series.

values : string;

valuesFormatCode

Represents format code of Values’s NumberList.

valuesFormatCode : string;

xValuesFormatCode

Represents format code of X Values’s NumberList.

xValuesFormatCode : string;

xValues

Represents the x values of the chart series.

xValues : string;

bubbleSizes

Gets or sets the bubble sizes values of the chart series.

bubbleSizes : string;

trendLines

Readonly. Returns all the trendlines of this series.

trendLines : TrendlineCollection;

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.

smooth : boolean;

shadow

True if the series has a shadow.

shadow : boolean;

has3DEffect

True if the series has a three-dimensional appearance. Applies only to bubble charts.

has3DEffect : boolean;

bar3DShapeType

Gets or sets the 3D shape type used with the 3-D bar or column chart.

bar3DShapeType : Bar3DShapeType;

dataLabels

Readonly. Represents the DataLabels object for the specified ASeries.

dataLabels : DataLabels;

type

Gets or sets a data series’ type.

type : ChartType;

marker

Readonly. Gets the marker.

marker : Marker;

plotOnSecondAxis

Indicates if this series is plotted on second value axis.

plotOnSecondAxis : boolean;

xErrorBar

Readonly. Represents X direction error bar of the series.

xErrorBar : ErrorBar;

yErrorBar

Readonly. Represents Y direction error bar of the series.

yErrorBar : ErrorBar;

hasHiLoLines

True if the line chart has high-low lines. Applies only to line charts.

hasHiLoLines : boolean;

hiLoLines

Readonly. Returns a HiLoLines object that represents the high-low lines for a series on a line chart. Applies only to line charts.

hiLoLines : Line;

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.

hasSeriesLines : boolean;

seriesLines

Readonly. 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.

seriesLines : Line;

hasDropLines

True if the chart has drop lines. Applies only to line chart or area charts.

hasDropLines : boolean;

dropLines

Readonly. Returns a 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.

dropLines : Line;

hasUpDownBars

True if a line chart has up and down bars. Applies only to line charts.

hasUpDownBars : boolean;

upBars

Readonly. Returns an DropBars object that represents the up bars on a line chart. Applies only to line charts.

upBars : DropBars;

downBars

Readonly. Returns a DropBars object that represents the down bars on a line chart. Applies only to line charts.

downBars : DropBars;

isColorVaried

Represents if the color of points is varied. The chart must contain only one series.

isColorVaried : boolean;

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.

gapWidth : number;

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.

firstSliceAngle : number;

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.

overlap : number;

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.

secondPlotSize : number;

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.

splitType : ChartSplitType;

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.

splitValue : number;

isAutoSplit

Readonly. Indicates whether the threshold value is automatic.

isAutoSplit : boolean;

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.

bubbleScale : number;

sizeRepresents

Gets or sets what the bubble size represents on a bubble chart.

sizeRepresents : BubbleSizeRepresents;

Remarks

BubbleSizeRepresents.SizeIsArea means the value Series.BubbleSizes is the area of the bubble. BubbleSizeRepresents.SizeIsWidth means the value Series.BubbleSizes is the width of the bubble.

showNegativeBubbles

True if negative bubbles are shown for the chart group. Valid only for bubble charts.

showNegativeBubbles : boolean;

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.

doughnutHoleSize : number;

explosion

The distance of an open pie slice from the center of the pie chart is expressed as a percentage of the pie diameter.

explosion : number;

hasRadarAxisLabels

True if a radar chart has category axis labels. Applies only to radar charts.

hasRadarAxisLabels : boolean;

hasLeaderLines

True if the series has leader lines.

hasLeaderLines : boolean;

leaderLines

Readonly. 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.

leaderLines : Line;

legendEntry

Readonly. Gets the legend entry according to this series.

legendEntry : LegendEntry;

shapeProperties

Readonly. Gets the ShapePropertyCollection object that holds the visual shape properties of the Series.

shapeProperties : ShapePropertyCollection;

move(number)

Moves the series up or down.

move(count: number) : void;

Parameters:

ParameterTypeDescription
countnumberThe 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.