ValueToPoint Method

ValueToPoint method as it applies to the ChAxis object.

Returns a Coordinate object that contains information about pixel coordinates of a data point on the specified axis.

expression.ValueToPoint(Value)

*expression   * Required. An expression that returns a ChAxis object.

Value   Required Variant. The value that you want to returns the pixel coordinates for.

ValueToPoint method as it applies to the ChSeries object.

Returns a Coordinate object that contains information about pixel coordinates for the specified data point.

expression.ValueToPoint(xvalue, yvalue, zvalue)

*expression   * Required. An expression that returns a ChSeries object.

xvalue   Required Variant. The value or category label on the category axis.

yvalue   Required Variant. The value on the value axis.

zvalue   Optional Variant. The value or series label on the series axis on 3D charts.

Remarks

Use the x and y properties of the returned Coordinate object to return the X and Y-coordinates for the specified data point.

Example

As it applies to the ChSeries object.

This 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 title to the pixel coordinates of the specified
    ' data point.
    chChart1.Title.Caption = "X(" & lXPos & ") Y(" & lYPos & ")"

End Sub

Applies to | ChAxis Object | ChSeries Object

See Also | Coordinate Object | X Property | Y Property