Table of Contents

Class XlsChartSerie

Namespace
Spire.Xls.Core.Spreadsheet.Charts
Assembly
Spire.XLS.dll
public class XlsChartSerie : XlsObject, IDisposable, IChartSerie, IExcelApplication, INamedObject
Inheritance
XlsChartSerie
Implements
Derived
Inherited Members

Properties

Bubbles

Bubble sizes for the series. The following code illustrates how to set Bubbles for IChartSerie in charts:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add(ExcelChartType.Bubble);//Set values and bubble chart rangeserie.Values = worksheet.Range["A1:C1"];;serie.Bubbles = worksheet.Range["A2:C2"];//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IXLSRange Bubbles { get; set; }

Property Value

IXLSRange

CategoryLabels

Category labels for the series. The following code illustrates how to set category labels for IChartSerie in charts:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add();//Set category labels and valuesserie.CategoryLabels = worksheet.Range["A1:C1"];serie.Values = worksheet.Range["A2:C2"];//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IXLSRange CategoryLabels { get; set; }

Property Value

IXLSRange

ChartGroup

public int ChartGroup { get; }

Property Value

int

DataLabels

public IChartDataLabels DataLabels { get; }

Property Value

IChartDataLabels

DataPoints

Returns collection of data points. Read-only. The following code illustrates how to access the IChartDataPoints collection from IChartSerie:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set rangechart.DataRange = worksheet["A1:C3"];//Set data pointsIChartDataPoints dataPoints = chart.Series[0].DataPoints;//Set data labels value visibilitydataPoints.DefaultDataPoint.DataLabels.HasValue = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartDataPoints DataPoints { get; }

Property Value

IChartDataPoints

EnteredDirectlyBubbles

Represents bubble values as entered directly. The following code illustrates how series data for second value axis of ExcelChartType.Bubble charts can be directly given for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add(ExcelChartType.Bubble);//Set direct valuesserie.EnteredDirectlyValues = new object[] { 10, 20, 30 };//Set bubble chart direct valuesserie.EnteredDirectlyBubbles = new object[] { 1, 4, 2 };//Save to fileworkbook.SaveToFile("Chart.xlsx");
public object[] EnteredDirectlyBubbles { get; set; }

Property Value

object[]

EnteredDirectlyCategoryLabels

Represents category values as entered directly. The following code illustrates how series category labels can be directly given for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add(ExcelChartType.Pie);//Set direct valuesserie.EnteredDirectlyValues = new object[] { 2000, 1000, 1000 };//Set direct category labelserie.EnteredDirectlyCategoryLabels = new object[] { "Total Income", "Expenses", "Profit" };//Save to fileworkbook.SaveToFile("Chart.xlsx");
public object[] EnteredDirectlyCategoryLabels { get; set; }

Property Value

object[]

EnteredDirectlyValues

Represents value as entered directly. The following code illustrates how series data can be directly given for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add(ExcelChartType.Pie);//Set direct valuesserie.EnteredDirectlyValues = new object[] { 2000, 1000, 1000 };//Set direct category labelserie.EnteredDirectlyCategoryLabels = new object[] { "Total Income", "Expenses", "Profit" };//Save to fileworkbook.SaveToFile("Chart.xlsx");
public object[] EnteredDirectlyValues { get; set; }

Property Value

object[]

ErrorBarsX

Represents X error bars. Read only.

public IChartErrorBars ErrorBarsX { get; }

Property Value

IChartErrorBars

ErrorBarsY

Represents Y error bars. Read only.

public IChartErrorBars ErrorBarsY { get; }

Property Value

IChartErrorBars

Format

Returns format of current serie. The following code illustrates how to access the IChartSerieDataFormat from IChartSerie:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set rangechart.DataRange = worksheet["A1:C2"];//Set chart typechart.ChartType = ExcelChartType.Line;//Set serie formatIChartSerieDataFormat format = chart.Series[0].Format;//Set marker styleformat.MarkerStyle = ChartMarkerType.Star;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartSerieDataFormat Format { get; }

Property Value

IChartSerieDataFormat

HasDroplines

public bool HasDroplines { set; }

Property Value

bool

HasErrorBarsX

Indicates if serie contains X error bars.

public bool HasErrorBarsX { get; set; }

Property Value

bool

HasErrorBarsY

Indicates if serie contains Y error bars.

public bool HasErrorBarsY { get; set; }

Property Value

bool

Index

Represents index of the series.

public int Index { get; }

Property Value

int

InvertNegaColor

Indicates wheter to invert its colors if the value is negative.

public bool? InvertNegaColor { get; set; }

Property Value

bool?

Name

Name of the series. The following code illustrates how to access the name of the IChartSerie:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add("BarSerie");//Set category labels and valuesserie.CategoryLabels = worksheet.Range["A1:C1"];serie.Values = worksheet.Range["A2:C2"];//Get Serie nameConsole.Write(serie.Name);//Save to fileworkbook.SaveToFile("Chart.xlsx");
public string Name { get; set; }

Property Value

string

NameOrFormula

public string NameOrFormula { get; }

Property Value

string

NamedRange

Series Name range for the series.

public CellRange NamedRange { get; }

Property Value

CellRange

Number

Number of the series.

public int Number { get; }

Property Value

int

ParentSeries

Gets parent serie collection. Read - only.

public XlsChartSeries ParentSeries { get; }

Property Value

XlsChartSeries

ParetoLineFormat

public IChartFrameFormat ParetoLineFormat { get; }

Property Value

IChartFrameFormat

PointNumber

Returns number of points in the series. Read-only.

public int PointNumber { get; }

Property Value

int

RealIndex

public int RealIndex { get; set; }

Property Value

int

SerieType

Represents serie type. The following code illustrates how to set SerieType for charts:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set rangechart.DataRange = worksheet["A1:C2"];//Set chart typechart.Series[0].SerieType = ExcelChartType.Line;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public ExcelChartType SerieType { get; set; }

Property Value

ExcelChartType

StartType

Returns serie start type. Read-only.

public string StartType { get; }

Property Value

string

TrendLines

Represents serie trend lines collection. Read only.

public IChartTrendLines TrendLines { get; }

Property Value

IChartTrendLines

UsePrimaryAxis

Indicates whether to use primary axis for series drawing. The following code illustrates how the secondary axis can be used by disabling primary axis:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set rangechart.DataRange = worksheet["A1:C3"];//Set secondary axisIChartSerie serie = chart.Series[1];serie.UsePrimaryAxis = false;chart.SecondaryCategoryAxis.Visible = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool UsePrimaryAxis { get; set; }

Property Value

bool

Values

Values range for the series. The following code illustrates how to set values for IChartSerie in charts:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set serieIChartSerie serie = chart.Series.Add();//Set category labels and valuesserie.CategoryLabels = worksheet.Range["A1:C1"];serie.Values = worksheet.Range["A2:C2"];//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IXLSRange Values { get; set; }

Property Value

IXLSRange

Methods

Clone(object, Dictionary<string, string>, Dictionary<int, int>)

public XlsChartSerie Clone(object parent, Dictionary<string, string> newNames, Dictionary<int, int> fontIndexes)

Parameters

parent object
newNames Dictionary<string, string>
fontIndexes Dictionary<int, int>

Returns

XlsChartSerie

ErrorBar(bool)

public IChartErrorBars ErrorBar(bool bIsY)

Parameters

bIsY bool

Returns

IChartErrorBars

ErrorBar(bool, IXLSRange, IXLSRange)

public IChartErrorBars ErrorBar(bool bIsY, IXLSRange plusRange, IXLSRange minusRange)

Parameters

bIsY bool
plusRange IXLSRange
minusRange IXLSRange

Returns

IChartErrorBars

ErrorBar(bool, ErrorBarIncludeType)

public IChartErrorBars ErrorBar(bool bIsY, ErrorBarIncludeType include)

Parameters

bIsY bool
include ErrorBarIncludeType

Returns

IChartErrorBars

ErrorBar(bool, ErrorBarIncludeType, ErrorBarType)

public IChartErrorBars ErrorBar(bool bIsY, ErrorBarIncludeType include, ErrorBarType type)

Parameters

bIsY bool
include ErrorBarIncludeType
type ErrorBarType

Returns

IChartErrorBars

ErrorBar(bool, ErrorBarIncludeType, ErrorBarType, double)

public IChartErrorBars ErrorBar(bool bIsY, ErrorBarIncludeType include, ErrorBarType type, double numberValue)

Parameters

bIsY bool
include ErrorBarIncludeType
type ErrorBarType
numberValue double

Returns

IChartErrorBars

GetCommonSerieFormat()

Gets common serie format.

public XlsChartFormat GetCommonSerieFormat()

Returns

XlsChartFormat

Returns common serie format.

GetSerieNameRange()

public IXLSRange GetSerieNameRange()

Returns

IXLSRange

SetDefaultName(string)

public void SetDefaultName(string defaultName)

Parameters

defaultName string