DrawPolyLine Method

Microsoft Office Web Components Visual Basic

expression.DrawPolyLine(xValues, yValues)

expression    Required. An expression that returns a ChChartDraw object.

xValues   Required Variant. An array containing the X values used to calculate the line.

yValues   Required Variant. An array containing the Y values used to calculate the line.

Example

This example uses the AfterRender event to draw a custom border around Chartspace1.

Sub ChartSpace1_AfterRender(drawObject, chartObject)

    Dim alXValues(9)
    Dim alYValues(9)
    Dim iCutOff
    Dim chConstants

    iCutOff = 10

    Set chConstants = ChartSpace1.Constants

    If TypeName(chartObject) = "ChChart" Then

        ' Set the array containing the x values for
        ' the line.
        alXValues(0) = chartObject.Left + iCutOff
        alXValues(1) = chartObject.Right - iCutOff
        alXValues(2) = chartObject.Right
        alXValues(3) = chartObject.Right
        alXValues(4) = chartObject.Right - iCutOff
        alXValues(5) = chartObject.Left + iCutOff
        alXValues(6) = chartObject.Left
        alXValues(7) = chartObject.Left
        alXValues(8) = chartObject.Left + iCutOff

        ' Set the array containing the y values for
        ' the line.
        alYValues(0) = chartObject.Top
        alYValues(1) = chartObject.Top
        alYValues(2) = chartObject.Top + iCutOff
        alYValues(3) = chartObject.Bottom - iCutOff
        alYValues(4) = chartObject.Bottom
        alYValues(5) = chartObject.Bottom
        alYValues(6) = chartObject.Bottom - iCutOff
        alYValues(7) = chartObject.Top + iCutOff
        alYValues(8) = chartObject.Top

        ' Set the properties for the line.
        drawObject.Line.Color = "blue"
        drawObject.Line.Weight = chConstants.owcLineWeightThick
        drawObject.Line.DashStyle = chConstants.chLineLongDashDot

        ' Draw the line.
        drawObject.DrawPolyLine alXValues, alYValues

    End If

End Sub