IChartDataLabels Properties |
The IChartDataLabels type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() |
BackgroundMode |
Display mode of the background.
(Inherited from
IChartTextArea
.)
![]()
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>
|
![]() |
Color |
Gets / sets font color. Searches for the closestes color in
the workbook palette.
(Inherited from
IFont
.)
|
![]() ![]() |
Delimiter |
Delimeter.
![]()
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>
|
![]() |
FontName |
Returns or sets the font name. Read / write string.
(Inherited from
IFont
.)
|
![]() ![]() |
FrameFormat |
Return format of the text area.
(Inherited from
IChartTextArea
.)
![]()
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>
|
![]() ![]() |
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:
<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>
|
![]() ![]() |
HasCategoryName |
Indicates whether category name is in data labels.
![]()
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>
|
![]() ![]() |
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:
<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>
|
![]() ![]() |
HasPercentage |
Indicates whether percentage is in data labels.
![]()
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>
|
![]() ![]() |
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:
<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>
|
![]() ![]() |
HasValue |
Indicates whether value is in data labels.
![]()
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>
|
![]() |
IsAutoColor |
Indicates whether color is automatically selected. Read-only.
(Inherited from
IFont
.)
|
![]() ![]() |
IsAutoMode |
True if background is set to automatic.
(Inherited from
IChartTextArea
.)
![]()
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>
|
![]() |
IsBold |
True if the font is bold. Read / write Boolean.
(Inherited from
IFont
.)
|
![]() |
IsItalic |
True if the font style is italic. Read / write Boolean.
(Inherited from
IFont
.)
|
![]() |
IsResizeShapeToFitText |
Gets or sets a value indicating whether the shape should automatically resize to fit the text within it.
|
![]() |
IsStrikethrough |
True if the font is struck through with a horizontal line.
Read / write Boolean
(Inherited from
IFont
.)
|
![]() |
IsSubscript |
True if the font is formatted as subscript.
False by default. Read / write Boolean.
(Inherited from
IFont
.)
|
![]() |
IsSuperscript |
True if the font is formatted as superscript. False by default.
Read/write Boolean
(Inherited from
IFont
.)
|
![]() |
IsTextWrapped |
Gets or sets a value indicating whether the text within the control is wrapped to fit within the control's bounds.
|
![]() |
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
.)
|
![]() |
NumberFormat |
Represents trend line label number format.
|
![]() |
Parent |
Gets the parent object of the current instance.
(Inherited from
IExcelApplication
.)
|
![]() ![]() |
Position |
Represents data labels position.
![]()
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>
|
![]() ![]() |
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:
<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>
|
![]() |
Size |
Returns or sets the size of the font. Read / write Variant.
(Inherited from
IFont
.)
|
![]() |
StrikethroughType |
Strikethrough Type.
Read / write sngStrike dblStrike
(Inherited from
IFont
.)
|
![]() ![]() |
Text |
Area's text.Some items(such as legend,axis...) maybe invalid.
(Inherited from
IChartTextArea
.)
![]()
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>
|
![]() ![]() |
TextRotationAngle |
Text rotation angle.
(Inherited from
IChartTextArea
.)
![]()
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>
|
![]() |
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
.)
|
![]() |
VerticalAlignment |
Gets / sets font vertical alignment.
(Inherited from
IFont
.)
|