Coordinate Object

Microsoft Office Web Components Object Model

Coordinate Object

         
Multiple objects Coordinate

Stores the X and Y-coordinates of a data point for later retrieval.

Using the Coordinate object

Use the ValueToPoint method of the ChAxis or ChSeries object to return a Coordinate object.

Use the x and y properties of the Coordinate object to return the X and Y-coordinates of the data point currently stored in the Coordinate object.

The following example changes the title of the first chart in Chartspace1 to the pixel coordinates of a data point in the first series of the chart.

Sub GetPixelCoordinates()

    Dim chChart1
    Dim lXPos
    Dim lYPos
    Dim coPointCoordinates

    ' Set a variable to the first chart in Chartspace1.
    Set chChart1 = ChartSpace1.Charts(0)

    ' Enable the title for the chart.
    chChart1.HasTitle = True

    ' Set a Coordinate object to the coordinates of a data point.
    Set coPointCoordinates = chChart1.SeriesCollection(0).ValueToPoint("Pears", 10)

    ' Set a variable to the X-coordinate.
    lXPos = coPointCoordinates.x

    ' Set a variable to the Y-coordinate.
    lYPos = coPointCoordinates.y

    ' Set the chart's titles to the pixel coordinates of the specified
    ' data point.
    chChart1.Title.Caption = "X(" & lXPos & ") Y(" & lYPos & ")"

End Sub