Set properties of the legend.
#Include <ExcelChart.au3>
_XLChart_LegendSet($oChart[, $iPosition = Default[, $iLeft = Default[, $iTop = Default[, $iWidth = Default[, $iHeight = Default[, $bShadow = Default]]]]]])
Parameters
$oChart | Chart for which the legend properties should be set |
$iPosition | Optional: Represents the position of the legend on the chart. Please see the XlLegendPosition enumeration (default = Default) |
$iLeft | Optional: Value in points representing the distance from the left edge of the legend to the left edge of the chart area (default = Default) |
$iTop | Optional: Value in points representing the distance from the top edge of the legend to the top of the chart area (default = Default) |
$iWidth | Optional: Value in points representing the width of the legend (default = Default) |
$iHeight | Optional: Value in points representing the height of the legend (default = Default) |
$bFrame | Optional: True if the legend has a frame (default = True) |
$bShadow | Optional: True if the legend has a shadow (default = Default) |
Return Value
Success: Returns 1
Remarks
If $iPosition is set parameters $iLeft and $iTop will be ignored
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, 0, -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 legend on chart 1 to the bottom, set shadow
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Legend to the bottom, width + shadow")
Global $aResult = _XLChart_LegendSet($aExcel[1], $xlLegendPositionBottom, Default, Default, 250, Default, Default, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_LegendSet' on line " & @ScriptLineNumber)
; *****************************************************************************
; Example 2
; Set legend on chart 2 to the upper right corner, set width, set frame + shadow
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Legend to the upper right, frame + shadow")
$aResult = _XLChart_LegendSet($aExcel[2], $xlLegendPositionCorner, Default, Default, Default, Default, True, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_LegendSet' on line " & @ScriptLineNumber)