Table of Contents

Interface IChartDataPoint

Namespace
Spire.Xls.Core
Assembly
Spire.XLS.dll

Represents data point in the chart.

public interface IChartDataPoint : IExcelApplication
Inherited Members

Properties

DataFormat

Gets / sets data format. The following code illustrates how to access DataFormat and set ChartMarkerType.star to IChartSerieDataFormat.MarkerStyle:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart and set range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].DataFormat;

//Set marker style
format.MarkerStyle = ChartMarkerType.Star;

//Save to file
workbook.SaveToFile("Chart.xlsx");
IChartSerieDataFormat DataFormat { get; }

Property Value

IChartSerieDataFormat

DataLabels

Returns data labels object for the data point. Read-only. The following code illustrates how to access the IChartDataLabels for a particular IChartDataPoint:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart and set range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Get the chart serie
IChartSerie serie = chart.Series[0];

//Set data labels value visibility
serie.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;

//Save to file
workbook.SaveToFile("Chart.xlsx");
IChartDataLabels DataLabels { get; }

Property Value

IChartDataLabels

Index

Gets index of the point in the points collection. The following code illustrates how to access the Index of a IChartDataPoint in the IChartDataPoints collection:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart and set range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set serie
IChartSerie serie = chart.Series[0];

//Get index
Console.WriteLine(serie.DataPoints[0].Index);
int Index { get; }

Property Value

int

IsDefault

Indicates whether this data point is default data point. Read-only. The following code illustrates how to access the IChartDataLabels for a particular IChartDataPoint:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart and set range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set serie format
IChartDataPoints dataPoints = chart.Series[0].DataPoints;

//Check default Datapoint
Console.WriteLine(dataPoints.DefaultDataPoint.IsDefault);
Console.WriteLine(dataPoints[0].IsDefault);
bool IsDefault { get; }

Property Value

bool