This documentation is archived and is not being maintained.

AfterLayout Event

Office 2003

Occurs after all charts in the specified chart control have been laid out, but before they have been rendered. During this event, you can reposition the ChTitle, ChLegend, ChChart, and ChAxis objects of each chart by changing their Left and Top properties. You can reposition the ChPlotArea object by changing its Left, Top, Right, and Bottom properties. These properties cannot be changed outside of this event.

Private Sub ChartSpace_AfterLayout( ByVal drawObject As ChChartDraw)

drawObject A ChChartDraw object. Use the methods and properties of this object to manipulate drawing objects on the chart.


The AllowLayoutEvents property must be set to True in order to capture this event.


This example uses the AfterLayout event to move the title for the first chart in Chartspace1 to the left side of the chart. It then moves the legend towards the top of the chart.

Private Sub ChartSpace1_AfterLayout(drawObject)

    ' Move the title to the left side of the chart.
    ChartSpace1.Charts(0).Title.Left = 1

    ' Move the legend towards the top of the chart.
    ChartSpace1.Charts(0).Legend.Top = 20

End Sub


Applies to | ChartSpace Object