Function Reference

_XLChart_GridSet

Set gridlines of a chart.

#Include <ExcelChart.au3>
_XLChart_GridSet($oObject[, $iMajorGridline = Default[, $iMinorGridline = Default]])

 

Parameters

$oObject Object of the axis for which the grid properties should be set
$bMajorGridline Optional: True if the axis has major gridlines. Only axes in the primary axis group can have gridlines (default = Default)
$bMinorGridline Optional: True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines (default = Default)

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @error:
    1 - $oObject is no object
    2 - $iMajorGridline is not boolean
    3 - $iMinorGridline is not boolean

 

Remarks

To change the units between major and/or minor grid lines please see _XLChart_TicksSet

 

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, -1, -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
; Change gridlines on x-axis of Chart 1
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Gridlines for x-axis")
_XLChart_GridSet($aExcel[1].Axes($xlCategory), True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_GridSet' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 2
; Change gridlines y-axis of Chart 1
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Gridlines for y-axis")
_XLChart_GridSet($aExcel[1].Axes($xlValue), Default, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_GridSet' on line " & @ScriptLineNumber)