HasChartSpaceLegend Property

Microsoft Office Web Components Object Model

HasChartSpaceLegend Property

       

True if the specified chart workspace has a legend. Read/write Boolean.

expression.HasChartSpaceLegend

expression   Required. An expression that returns a ChartSpace object.

Remarks

Setting this property to False causes the legend to be deleted from the chart workspace. When this happens, all custom formatting is lost and must be reset if the property is subsequently set to True.

Example

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


Sub Format_ChartSpace()
    Dim chConstants
    
    Set chConstants = ChartSpace1.Constants
    
    ' Enable the title for the chartspace.
    ChartSpace1.HasChartSpaceTitle = True

    ' Set the chartspace title.
    ChartSpace1.ChartSpaceTitle.Caption = "Monthly Sales Data"
    
    ' Enable the legend for the chartspace.
    ChartSpace1.HasChartSpaceLegend = True

    ' Specify the position of the chartspace legend.
    ChartSpace1.ChartSpaceLegend.Position = chConstants.chLegendPositionLeft
End Sub