Table of Contents

Class XlsChartDataLabels

Namespace
Spire.Xls.Core.Spreadsheet.Charts
Assembly
Spire.XLS.dll
public class XlsChartDataLabels : XlsObject, IDisposable, IChartDataLabels, IChartTextArea, IFont, IExcelApplication, IOptimizedUpdate
Inheritance
XlsChartDataLabels
Implements
Derived
Inherited Members

Properties

BackgroundMode

Display mode of the background.

public ChartBackgroundMode BackgroundMode { get; set; }

Property Value

ChartBackgroundMode

Color

Gets or sets color.

public Color Color { get; set; }

Property Value

Color

Delimiter

Delimeter. The following code illustrates how to access the IChartDataLabels and set delimiter for data labels:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.ColumnClustered;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set ' ' symbol as separator for data labelsdataLabels.HasValue = true;dataLabels.HasSeriesName = true;dataLabels.Delimiter =" ";//Save to fileworkbook.SaveToFile("Chart.xlsx");
public string Delimiter { get; set; }

Property Value

string

Font

[Obsolete("This properties is obsolete. \r Modify properties of fontImpl will affect others. Recommend direct use properties of ChartDataLabels\r modify the font style.")]
public XlsFont Font { get; }

Property Value

XlsFont

FontName

Returns or sets the font name. Read / write string.

public string FontName { get; set; }

Property Value

string

Format

public XlsChartSerieDataFormat Format { get; }

Property Value

XlsChartSerieDataFormat

FrameFormat

Return format of the text area. The following code illustrates the use of FrameFormat property:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chartIChart chart = worksheet.Charts.Add();//Set rangechart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Get the formatting options of the chart for text areachart.ChartTitleArea.Text = "Student Chart";chart.ChartTitleArea.FrameFormat.Border.Color = Color.Brown;chart.ChartTitleArea.FrameFormat.Interior.Pattern = ExcelPatternType.Percent25;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartFrameFormat FrameFormat { get; }

Property Value

IChartFrameFormat

HasBubbleSize

Indicates whether bubble size is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the bubble sizes:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.Bubble;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the bubble sizesdataLabels.HasBubbleSize = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasBubbleSize { get; set; }

Property Value

bool

HasCategoryName

Indicates whether category name is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the categories:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.ColumnClustered;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the category namesdataLabels.HasCategoryName = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasCategoryName { get; set; }

Property Value

bool

HasFormula

Gets or sets a value indicating whether this instance has formula.

public bool HasFormula { get; }

Property Value

bool

HasLegendKey

Indicates whether legend key is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the legend keys:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.ColumnClustered;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the legend keydataLabels.HasValue = true;dataLabels.HasLegendKey = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasLegendKey { get; set; }

Property Value

bool

HasManualLayout

Indicates whether border formatting object was created. Read-only.

public bool HasManualLayout { get; }

Property Value

bool

HasPercentage

Indicates whether percentage is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the percentage values:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart typechart.ChartType = ExcelChartType.Pie;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the percentage valuesdataLabels.HasPercentage = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasPercentage { get; set; }

Property Value

bool

HasSeriesName

Indicates whether series name is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the serie name:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.ColumnClustered;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the serie namedataLabels.HasSeriesName = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasSeriesName { get; set; }

Property Value

bool

HasValue

Indicates whether value is in data labels. The following code illustrates how to access the IChartDataLabels and set to shows the values:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set chart typechart.ChartType = ExcelChartType.ColumnClustered;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the valuesdataLabels.HasValue = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasValue { get; set; }

Property Value

bool

HasWedgeCallout

public bool HasWedgeCallout { get; set; }

Property Value

bool

Height

Y-size. 1/4000 of chart plot. IsHMode Shall set to True

public int Height { get; set; }

Property Value

int

Index

public int Index { get; }

Property Value

int

IsAutoColor

Indicates whether color has automatic color. Read-only.

public bool IsAutoColor { get; }

Property Value

bool

IsAutoMode

True if background is set to automatic.

public bool IsAutoMode { get; }

Property Value

bool

IsBold

True if the font is bold. Read / write Boolean.

public bool IsBold { get; set; }

Property Value

bool

IsHMode

false value Specifies that the Height shall be interpreted as the Bottom of the chart element..

public bool IsHMode { get; set; }

Property Value

bool

IsItalic

True if the font style is italic. Read / write Boolean.

public bool IsItalic { get; set; }

Property Value

bool

IsResizeShapeToFitText

public bool IsResizeShapeToFitText { get; set; }

Property Value

bool

IsStrikethrough

True if the font is struck through with a horizontal line. Read / write Boolean

public bool IsStrikethrough { get; set; }

Property Value

bool

IsSubscript

True if the font is formatted as subscript. False by default. Read / write Boolean.

public bool IsSubscript { get; set; }

Property Value

bool

IsSuperscript

True if the font is formatted as superscript. False by default. Read/write Boolean

public bool IsSuperscript { get; set; }

Property Value

bool

IsTextWrapped

public bool IsTextWrapped { get; set; }

Property Value

bool

IsWMode

false value Specifies that the Width shall be interpreted as the Right of the chart element..

public bool IsWMode { get; set; }

Property Value

bool

IsXMode

true value Specifies that the X shall be interpreted as the Left of the chart element..

public bool IsXMode { get; set; }

Property Value

bool

IsYMode

true value Specifies that the Y shall be interpreted as the Top of the chart element..

public bool IsYMode { get; set; }

Property Value

bool

KnownColor

Returns or sets the primary color of the object.

public ExcelColors KnownColor { get; set; }

Property Value

ExcelColors

NumberFormat

Represents trend line label number format.

public string NumberFormat { get; set; }

Property Value

string

Position

Represents data labels position. The following code illustrates how to access the IChartDataLabels and set to the position for labels:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart typechart.ChartType = ExcelChartType.Pie;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the leader linesdataLabels.HasValue = true;dataLabels.Position = DataLabelPositionType.Outside;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public DataLabelPositionType Position { get; set; }

Property Value

DataLabelPositionType

ShowLeaderLines

Indicates whether Leader Lines is in data labels. The following code illustrates how to access the IChartDataLabels and set to leader lines to show:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart typechart.ChartType = ExcelChartType.Pie;//Get the chart serieIChartSerie serie = chart.Series[0];//Get serie data labelsIChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;//Set the data label to show the leader linesdataLabels.HasValue = true;dataLabels.Position = DataLabelPositionType.Outside;dataLabels.ShowLeaderLines = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool ShowLeaderLines { get; set; }

Property Value

bool

Size

Returns or sets the size of the font. Read / write Variant.

public double Size { get; set; }

Property Value

double

StrikethroughType

public string StrikethroughType { get; set; }

Property Value

string

Text

Gets or sets text.

public string Text { get; set; }

Property Value

string

TextArea

Text of area.

public XlsChartDataLabelArea TextArea { get; }

Property Value

XlsChartDataLabelArea

TextRotationAngle

Text rotation angle. between -90 and 90.

public int TextRotationAngle { get; set; }

Property Value

int

Underline

Returns or sets the type of underline applied to the font.

public FontUnderlineType Underline { get; set; }

Property Value

FontUnderlineType

ValueFromCell

Set Range for value. above Excel 2013

public CellRange ValueFromCell { get; set; }

Property Value

CellRange

VerticalAlignment

Returns or sets font vertical alignment.

public FontVertialAlignmentType VerticalAlignment { get; set; }

Property Value

FontVertialAlignmentType

Width

X-size. 1/4000 of chart plot. IsWMode Shall set to True

public int Width { get; set; }

Property Value

int

X

X-position of upper-left corner. 1/4000 of chart plot. IsXMode Shall set to True

public int X { get; set; }

Property Value

int

Y

Y-position of upper-left corner. 1/4000 of chart plot. IsYMode Shall set to True

public int Y { get; set; }

Property Value

int

Methods

BeginUpdate()

public void BeginUpdate()

EndUpdate()

public void EndUpdate()

GetThemeColor(out ThemeColorType, out double)

public bool GetThemeColor(out ThemeColorType type, out double tint)

Parameters

type ThemeColorType
tint double

Returns

bool

SetThemeColor(ThemeColorType, double)

public void SetThemeColor(ThemeColorType type, double tint)

Parameters

type ThemeColorType
tint double