Click or drag to resize

IChartDataLabels Properties

The IChartDataLabels type exposes the following members.

Properties
Name Description
Public property Code example BackgroundMode
Display mode of the background.
Examples
The following code illustrates the use of BackgroundMode property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart</para><para>IChart chart = worksheet.Charts.Add();</para><para>//Set range</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Set the Area's text in the chart</para><para>chart.ChartTitleArea.Text = "Student Chart";</para><para>//Set the Display mode of the background</para><para>chart.ChartTitleArea.BackgroundMode = ChartBackgroundMode.Opaque;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChartTextArea .)
Public property Color
Gets / sets font color. Searches for the closestes color in the workbook palette.
(Inherited from IFont .)
Public property Code example Delimiter
Delimeter.
Examples
The following code illustrates how to access the IChartDataLabels and set delimiter for data labels:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set ' ' symbol as separator for data labels</para><para>dataLabels.HasValue = true;</para><para>dataLabels.HasSeriesName = true;</para><para>dataLabels.Delimiter =" ";</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property FontName
Returns or sets the font name. Read / write string.
(Inherited from IFont .)
Public property Code example FrameFormat
Return format of the text area.
Examples
The following code illustrates the use of FrameFormat property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart</para><para>IChart chart = worksheet.Charts.Add();</para><para>//Set range</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Get the formatting options of the chart for text area</para><para>chart.ChartTitleArea.Text = "Student Chart";</para><para>chart.ChartTitleArea.FrameFormat.Border.Color = Color.Brown;</para><para>chart.ChartTitleArea.FrameFormat.Interior.Pattern = ExcelPatternType.Percent25;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChartTextArea .)
Public property Code example HasBubbleSize
Indicates whether bubble size is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the bubble sizes:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Bubble;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the bubble sizes</para><para>dataLabels.HasBubbleSize = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example HasCategoryName
Indicates whether category name is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the categories:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the category names</para><para>dataLabels.HasCategoryName = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example HasLegendKey
Indicates whether legend key is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the legend keys:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the legend key</para><para>dataLabels.HasValue = true;</para><para>dataLabels.HasLegendKey = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example HasPercentage
Indicates whether percentage is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the percentage values:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Pie;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the percentage values</para><para>dataLabels.HasPercentage = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example HasSeriesName
Indicates whether series name is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the serie name:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the serie name</para><para>dataLabels.HasSeriesName = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example HasValue
Indicates whether value is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to shows the values:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.ColumnClustered;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the values</para><para>dataLabels.HasValue = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property IsAutoColor
Indicates whether color is automatically selected. Read-only.
(Inherited from IFont .)
Public property Code example IsAutoMode
True if background is set to automatic.
Examples
The following code illustrates the use of IsAutoMode property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart</para><para>IChart chart = worksheet.Charts.Add();</para><para>//Set range</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Set the Area's text in the chart</para><para>chart.ChartTitleArea.Text = "Student Chart";</para><para>//True if background is set to automatic</para><para>Console.WriteLine(chart.ChartTitleArea.IsAutoMode);</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChartTextArea .)
Public property IsBold
True if the font is bold. Read / write Boolean.
(Inherited from IFont .)
Public property IsItalic
True if the font style is italic. Read / write Boolean.
(Inherited from IFont .)
Public property IsResizeShapeToFitText
Gets or sets a value indicating whether the shape should automatically resize to fit the text within it.
Public property IsStrikethrough
True if the font is struck through with a horizontal line. Read / write Boolean
(Inherited from IFont .)
Public property IsSubscript
True if the font is formatted as subscript. False by default. Read / write Boolean.
(Inherited from IFont .)
Public property IsSuperscript
True if the font is formatted as superscript. False by default. Read/write Boolean
(Inherited from IFont .)
Public property IsTextWrapped
Gets or sets a value indicating whether the text within the control is wrapped to fit within the control's bounds.
Public property KnownColor
Returns or sets the primary color of the object, as shown in the following table. Use the RGB function to create a color value. Read / write Integer.
(Inherited from IFont .)
Public property NumberFormat
Represents trend line label number format.
Public property Parent
Gets the parent object of the current instance.
(Inherited from IExcelApplication .)
Public property Code example Position
Represents data labels position.
Examples
The following code illustrates how to access the IChartDataLabels and set to the position for labels:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Pie;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the leader lines</para><para>dataLabels.HasValue = true;</para><para>dataLabels.Position = DataLabelPositionType.Outside;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Code example ShowLeaderLines
Indicates whether Leader Lines is in data labels.
Examples
The following code illustrates how to access the IChartDataLabels and set to leader lines to show:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Pie;</para><para>//Get the chart serie</para><para>IChartSerie serie = chart.Series[0];</para><para>//Get serie data labels</para><para>IChartDataLabels dataLabels = serie.DataPoints.DefaultDataPoint.DataLabels;</para><para>//Set the data label to show the leader lines</para><para>dataLabels.HasValue = true;</para><para>dataLabels.Position = DataLabelPositionType.Outside;</para><para>dataLabels.ShowLeaderLines = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public property Size
Returns or sets the size of the font. Read / write Variant.
(Inherited from IFont .)
Public property StrikethroughType
Strikethrough Type. Read / write sngStrike dblStrike
(Inherited from IFont .)
Public property Code example Text
Area's text.Some items(such as legend,axis...) maybe invalid.
Examples
The following code illustrates the use of Text property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart</para><para>IChart chart = worksheet.Charts.Add();</para><para>//Set range</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Set the Area's text in the chart</para><para>chart.ChartTitleArea.Text = "Student Chart";</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChartTextArea .)
Public property Code example TextRotationAngle
Text rotation angle.
Examples
The following code illustrates the use of TextRotationAngle property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart</para><para>IChart chart = worksheet.Charts.Add();</para><para>//Set range</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Set the Area's text in the chart</para><para>chart.ChartTitleArea.Text = "Student Chart";</para><para>//Set the Text rotation angle</para><para>chart.ChartTitleArea.TextRotationAngle = 30;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChartTextArea .)
Public property Underline
Returns or sets the type of underline applied to the font. Can be one of the following FontUnderlineTypeStyle constants. Read / write FontUnderlineType.
(Inherited from IFont .)
Public property VerticalAlignment
Gets / sets font vertical alignment.
(Inherited from IFont .)
Top
See Also