Axes Property

Microsoft Office Web Components Visual Basic

Returns the ChAxes collection for the specified chart. Use the Axes property to set the properties for a chart axis. Read-only.

For information about returning a single member of a collection, see Returning an Object from a Collection .

expression.Axes

expression    Required. An expression that returns a ChChart object.

Example

This example adds a title to, and changes the font of the value and category axes of the first chart in ChartSpace1.

Sub Format_Chart_Axes()

    Dim axCategoryAxis
    Dim axValueAxis

    ' Set a variable to the Category (X) axis.
    Set axCategoryAxis = ChartSpace1.Charts(0).Axes(0)
    
    ' Set a variable to the Value (Y) axis.
    Set axValueAxis = ChartSpace1.Charts(0).Axes(1)

    ' The following two lines of code enable, and then
    ' set the title for the category axis.
    axCategoryAxis.HasTitle = True
    axCategoryAxis.Title.Caption = "Sales by Quarter"
    
    ' The following three lines of code set the font
    ' for the values displayed on the category axis.
    axCategoryAxis.Font = "Tahoma"
    axCategoryAxis.Font.Size = 8
    axCategoryAxis.Font.Bold = True

    ' The following two lines of code enable, and then
    ' set the title for the value axis.
    axValueAxis.HasTitle = True
    axValueAxis.Title.Caption = "Dollars ($)"
    
    ' The following three lines of code set the font
    ' for the values displayed on the value axis.
    axValueAxis.Font = "Tahoma"
    axValueAxis.Font.Size = 8
    axValueAxis.Font.Bold = True
end sub