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   * Required. An expression that returns a ChartSpace object.


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 chart workspace.
    ChartSpace1.HasChartSpaceTitle = True
    ' Set the title for the chart workspace.
    ChartSpace1.ChartSpaceTitle.Caption = "Monthly Sales Data"
    ' Enable the legend for the chart workspace.
    ChartSpace1.HasChartSpaceLegend = True
    ' Position the legend for the chart workspace.
    ChartSpace1.ChartSpaceLegend.Position = chConstants.chLegendPositionLeft
End Sub    

Applies to | ChartSpace Object

See Also | HasChartSpaceLegend Property | HasLegend Property | Legend Property