constant that represents how items are grouped on an axis.
ChartAxisUnitTypeEnum can be one of these ChartAxisUnitTypeEnum constants. |
chAxisUnitDay |
chAxisUnitMonth |
chAxisUnitQuarter |
chAxisUnitWeek |
chAxisUnitYear |
expression.GroupingUnitType
expression Required. An expression that returns a ChAxis object.
Remarks
Setting this property sets the GroupingType property to chAxisGroupingManual.
The Chart control automatically creates a time scale and groups on the category axis when the following conditions are true:
- The Chart control detects that the category information is a date.
- The Chart control is bound to a PivotTable list, and the PivotTable list is not bound to an OLAP data source.
Example
This example converts the first chart in Chartspace1 to a line chart, then formats the category axis so that the values are grouped by month. The average value of each month is displayed on the chart.
Sub FormatTimeScaling()
Dim chConstants
Dim axCategory
Set chConstants = ChartSpace1.Constants
' Change the chart to a Line chart.
ChartSpace1.Charts(0).Type = chConstants.chChartTypeLine
' Set a variable to the category axis.
Set axCategory = ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionCategory)
' Specify that you will determine the grouping settings of the
' axis. Note that this line of code is necessary only if the
' GroupingType property for the axis has been previously set to
' chAxisGroupingNone.
axCategory.GroupingType = chConstants.chAxisGroupingManual
' Group the category axis by month.
axCategory.GroupingUnitType = chConstants.chAxisUnitMonth
' Create a new grouping for every month.
axCategory.GroupingUnit = 1
' Display the average of the items in each group.
axCategory.GroupingTotalFunction = chConstants.chFunctionAvg
' A tick label is displayed for every month.
axCategory.TickLabelUnitType = chConstants.chAxisUnitMonth
' A tick mark is displayed for every three months.
axCategory.TickMarkUnitType = chConstants.chAxisUnitQuarter
End Sub