Function Reference

_XLChart_DatalabelSet

Set properties for the data labels of a data series.

#Include <ExcelChart.au3>
_XLChart_DatalabelSet($oObject[, $iType = Default[, $bShowValue = Default[, $bShowPercentage = Default[, $bShowLegendKey = Default[, $bShowSeriesName = Default[, $bShowCategoryName = Default[, $iPosition = Default[, $iOrientation = Default]]]]]]]])

 

Parameters

$oObject Object of the data series for which the data label properties should be set
$iType Optional: Type of data label to apply. Can be one of the XlDataLabelsType enumeration (default = Default)
$bShowValue Optional: True enables the value for the data label (default = Default)
$bShowPercentage Optional: True enables the percentage for the data label (default = Default)
$bShowLegendKey Optional: True shows the legend key next to the point (default = Default)
$bShowSeriesName Optional: True enables the series name for the data label (default = Default)
$bShowCategoryName Optional: True enables the category name for the data label (default = Default)
$iPosition Optional: Represents the position of the data label. Can be any of the XlDataLabelPosition enumeration (default = Default)
$iOrientation Optional: Represents the text orientation. Can be a value from –90 to 90 degree (default = Default)

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @error:
    1 - $oObject is no object
    2 - $iType is not an integer
    3 - $iShowValue is not boolean
    4 - $bShowPercentage is not boolean
    5 - $bShowLegendKey is not boolean
    6 - $bShowSeriesName is not boolean
    7 - $bShowCategoryName is not boolean
    8 - Error setting properties. See @extended for details (error returned by method ApplyDataLabels)
    9 - $iPosition is not an integer
    10 - $iOrientation is not an integer

 

Remarks

None.

 

Related

 

Example


#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include-once
#include <ExcelChart.au3>

; *****************************************************************************
; Create example environment
; *****************************************************************************
Global $aExcel = _XLChart_Example(True, 0, 7, -1, -1)
If @error = 2  Then Exit MsgBox(16, "Excel Chart Example Script", "The installed Excel version is not supported by this UDF!" & @CRLF & "Version must be >= 12 (Excel 2007).")
If @error <> 0 Then Exit MsgBox(16, "Excel Chart Example Script", "Error " & @error & " returned by _XLChart_Example on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 1
; Set data label chart 1: type, show values
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Data labels type")
Global $aResult = _XLChart_DatalabelSet($aExcel[1].SeriesCollection(1), 2, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_DatalabelSet' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 2
; Set data label chart 2:
; Type, show legend key, show percentage, show category name, font & size
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Data labels type, show legend key, show percentage, show category name, font & size")
$aResult = _XLChart_DatalabelSet($aExcel[2].SeriesCollection(1), 2, False, True, True, Default, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_DatalabelSet' on line " & @ScriptLineNumber)
$aResult = _XLChart_FontSet($aExcel[2].SeriesCollection(1).Datalabels, "Courier New", 12)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_FontSet' on line " & @ScriptLineNumber)