DrawEllipse Method

       

Draws an ellipse on the specified chart. Use the current settings of the Border and Interior properties to determine the properties of the new ellipse.

expression.DrawEllipse(Left, Top, Right, Bottom)

expression   Required. An expression that returns a ChChartDraw object.

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

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

Right  Required Long. Pixel coordinate of the right edge of the ellipse.

Bottom  Required Long. Pixel coordinate of the bottom edge of the ellipse.

Example

This example uses the BeforeRender event to cancel drawing the gridlines and plot area of the first chart in Chartspace1. The AfterRender event then replaces the plot area with an ellipse that is drawn after the chart is rendered.

Private Sub ChartSpace1_AfterRender(drawObject, chartObject)

    Dim chConstants

    Set chConstants = ChartSpace1.Constants

    ' Check to see if the chart has been rendered.
    If TypeName(chartObject) = "ChChart" Then

        ' The next three lines of code set the interior
        ' and border properties of the ellipse.
        drawObject.Interior.SetPresetGradient _
               chConstants.chGradientHorizontal, _
               chConstants.chGradientVariantStart, _
               Int((24 - 1 + 1) * Rnd + 1)
        drawObject.Border.Weight = 1
        drawObject.Border.Color = "black"

        ' Begin the drawing object.
        drawObject.BeginObject 1

        ' Draw the ellipse.
        drawObject.DrawEllipse chartObject.Left, chartObject.Bottom, _
                               chartObject.Right, chartObject.Top

        drawObject.EndObject

    End If

End Sub

Private Sub ChartSpace1_BeforeRender(chartObject, Cancel)

    Select Case TypeName(chartObject)

        Case "ChGridlines"

            ' Cancel the drawing of the gridlines.
            Cancel.Value = True

        Case "ChPlotArea"

            ' Cancel the drawing of the plot area.
            Cancel.Value = True

    End Select

End Sub