DrawText Method

Microsoft Office Web Components Object Model

DrawText Method

       

Draws a text string on a chart.

expression.DrawText(bstrText, Left, Top)

expression   Required. An expression that returns a ChChartDraw object.

bstrText  Required String. The text to draw on the chart.

Left  Required Long. Pixel coordinate of the left edge of the text.

Top  Required Long. Pixel coordinate of the top edge of the text.

Example

This example adds a text string to the upper-left corner of the plot area each time that the chart is re-drawn.

Sub ChartSpace1_AfterRender(drawObject, chartObject)

    Dim chChart1

    Set chChart1 = ChartSpace1.Charts(0)
	
    ' After the legend has been rendered, then add the text
    ' to the chart.
    If TypeName(chartObject) = "ChLegend" Then
        drawObject.DrawText "2000 Sales", chChart1.PlotArea.Left + 5, _
                            chChart1.PlotArea.Top
    End If

End Sub