Skip to content

Latest commit

 

History

History
94 lines (59 loc) · 2.36 KB

Project.chart.axes.md

File metadata and controls

94 lines (59 loc) · 2.36 KB
title ms.service ms.assetid ms.date ms.localizationpriority
Chart.Axes method (Project)
project-server
0ab295f0-de68-7b8f-50a7-55a1e378080b
06/08/2017
medium

Chart.Axes method (Project)

Returns an object that represents either a single axis or a collection of the axes on the chart.

Syntax

expression.Axes (Type, AxisGroup)

expression A variable that represents a Chart object.

Parameters

Name Required/Optional Data type Description
Type Optional Variant Specifies the axis to return. Can be one of the following Office.XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3D charts).
AxisGroup Optional Office.XlAxisGroup Specifies the axis group. The default value is xlPrimary; that is, if the AxisGroup argument is omitted, the primary group is used. 3D charts have only one axis group.
Type Optional Variant
AxisGroup Optional XLAXISGROUP

Return value

Object

Examples

The SetAxisTitle macro adds an axis label to the category axis in the chart.

Sub SetAxisTitle()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    With chartShape.Chart.Axes(xlCategory)
        .HasTitle = True
        .AxisTitle.Text = "Task"
    End With
End Sub

The AddCategoryGridlines macro adds gridlines to the category axis in the chart.

Sub AddCategoryGridlines()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.Axes(xlCategory).HasMajorGridlines = True
End Sub

The RemoveGridlines macro removes the major gridlines from both the category and value axes.

Sub RemoveGridlines()
    Dim chartShape As Shape
    Dim reportName As String
    Dim axes As Object
    Dim a As Object
    
    reportName = "Simple scalar chart"
    
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.Axes(xlCategory).HasMajorGridlines = False
    chartShape.Chart.Axes(xlValue).HasMajorGridlines = False
End Sub

[!includeSupport and feedback]