Function Reference

_XLChart_BarGroupSet

Set properties of a bar chart group.

#Include <ExcelChart.au3>
_XLChart_BarGroupSet($oObject[, $iGapWidth = Default[, $iOverlap = Default[, $bHasSeriesLines = Default]]])

 

Parameters

$oObject Chart group for which the properties should be set
$iGapWidth Optional: Sets the space between bar clusters, as a percentage of the bar width (default = Default)
$iOverlap Optional: Specifies how bars are positioned. Can be a value between –100 and 100 (default = Default)
$bHasSeriesLines Optional: True if the bar chart has series lines (default = Default). Only works for stacked bars

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @error:
    1 - $oObject is not an object
    2 - $iGapWidth is not an integer
    3 - $iOverlap is not an integer
    4 - $bHasSeriesLines is not boolean

 

Remarks

A chart contains one or more chart groups, each chart group contains one or more series, and
each series contains one or more points.

You can either pass an item of the ChartGroups collection or an item of the BarGroups collection (a ChartGroup object)

 

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, 0, -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)
; Change chart 1 to a bar chart
_XLChart_ChartSet($aExcel[1], $xlBarClustered)
If @error <> 0 Then Exit MsgBox(16, "Excel Chart Example Script", "Error " & @error & " returned by _XLChart_Example on line " & @ScriptLineNumber)
; Change chart 2 to a bar chart
_XLChart_ChartSet($aExcel[2], $xlBarClustered)
If @error <> 0 Then Exit MsgBox(16, "Excel Chart Example Script", "Error " & @error & " returned by _XLChart_Example on line " & @ScriptLineNumber)
; Change chart 3 to a bar chart
_XLChart_ChartSet($aExcel[3], $xlBarStacked)
If @error <> 0 Then Exit MsgBox(16, "Excel Chart Example Script", "Error " & @error & " returned by _XLChart_Example on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 1
; Set the gap width
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 1 ..." & @CRLF & "Set the gap width")
_XLChart_BarGroupSet($aExcel[1].BarGroups(1), 45, Default, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_BarGroupSet' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 2
; Set the overlap
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Set the overlap")
_XLChart_BarGroupSet($aExcel[2].ChartGroups(1), Default, 50)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_BarGroupSet' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 3
; Set the overlap to a negative value
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 2 ..." & @CRLF & "Set the overlap to a negative value")
_XLChart_BarGroupSet($aExcel[2].ChartGroups(1), Default, -50)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_BarGroupSet' on line " & @ScriptLineNumber)

; *****************************************************************************
; Example 4
; Set series lines
; *****************************************************************************
MsgBox(64, "Excel Chart Example Script", "Now changing chart 3 ..." & @CRLF & "Set series lines")
_XLChart_BarGroupSet($aExcel[3].ChartGroups(1), Default, Default, True)
If @error Then MsgBox(64, "Excel Chart Example Script", "Error " & @error & " returned by function '_XLChart_BarGroupSet' on line " & @ScriptLineNumber)