ChartSpaceLegend Property

Microsoft Office Web Components Object Model

ChartSpaceLegend Property

       

Returns a ChLegend object that represents the chart workspace legend. Use this property to set the properties for the chart workspace legend. Note that the ChartSpaceLegend property represents the legend for the entire chart workspace. Use the Legend property of the ChChart object to set the legend for individual charts within the chart workspace. Returns Nothing if the chart workspace does not have a legend. Read-only.

expression.ChartSpaceLegend

expression   Required. An expression that returns a ChartSpace object.

Example

This example sets the chart workspace title and positions the chart workspace legend on the left side of the workspace.

Sub SetLegend()
    Dim chConstants
    
    Set chConstants = ChartSpace1.Constants
    
    ' Enable the title for the chartspace.
    ChartSpace1.HasChartSpaceTitle = True
    
    ' Set the title for the chartspace.
    ChartSpace1.ChartSpaceTitle.Caption = "Monthly Sales Data"
    
    ' Enable the legend for the chartspace.
    ChartSpace1.HasChartSpaceLegend = True
    
    ' Position the legend fort he chartspace.
    ChartSpace1.ChartSpaceLegend.Position = chConstants.chLegendPositionLeft
End Sub