Visit Gigasoft's Web Site
 ProEssentials v9 Help

PEconvpixeltograph Method

*Within client side VBScript on a web page, use PEconvpixeltographEx

 

Scope: Graph, Scientific Graph, and Polar objects.

 

PEconvpixeltograph(pnAxis As Long, pnX As Long, pnY As Long, pfX As Double, pfY As Double, bRightAxis As Boolean, bTopAxis As Boolean, bViceVersa As Boolean) As Boolean

 

Parameter

Description

pnAxis

Axis index passed ByRef.

pnX

X axis coordinate pixel passed by reference.

pnY

Y axis coordinate pixel passed by reference.

pfX

X axis coordinate graph value passed by reference.

pfY

Y axis coordinate graph value passed by reference.

bRight

True to use Right Y Axis, else use Left.

bTop

True to use Top X Axis, else use Bottom.

bViceVersa

True to convert graph coordinates to pixels.

 

This function converts client pixel coordinates to graph coordinates, or vice versa, converts graph coordinates to client pixel coordinates.

 

To convert client pixel coordinates to graph coordinates: Initialize the integers pointed to by pnX and pnY with the client coordinates (0,0 represents the top-left corner of the control.) Call this function with bViceVersa = FALSE and the resulting graph coordinates will be stored in the double precision variables pointed to by pfX and pfY. In the case of multiple y axes, pnAxis will hold the resulting zero based axis index.

 

To convert graph coordinates to client pixel coordinates: Initialize the double precision variables pointed to by pfX and pfY with the graph coordinates. If the graph has multiple y axes, also initialize the zero based axis index pointed to by pnAxis. Call this function with bViceVersa = TRUE and the resulting client pixel coordinates will be stored in the integer variables pointed to by pnX and pnY.

 

If the graph has a right y axis or bottom x axis, you can perform conversions with respect to these axes with the bRight and bTop arguments. Keep in mind that right y axis and top x axis is referring to the use of RYAxisComparisonSubsets and/or TXAxisComparisonSubsets.

 

If OverlapMultiAxes is being implemented, then pnAxis should point to an integer that is initialized with the axis you want used when bViceVersa is FALSE. Since axes are overlapping there is no way to know which axis to use unless the developer provides this data.

 

Comments

The included example projects show examples of calling this function.

 

See Also: OCX Methods, PEconvpixeltograph.

 

Visual Basic Example

Private Sub Pego1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

 

'** get last mouse location within control **'

Dim nPixelX As Integer

Dim nPixelY As Integer

Pego1.GetLastMouseMove nPixelX, nPixelY

'** Get PEP_rectGRAPH to test if mouse is within grid area **'

Dim nLeft As Integer

Dim nTop As Integer

Dim nRight As Integer

Dim nBottom As Integer

Pego1.GetRectGraph nLeft, nTop, nRight, nBottom

 

If nPixelX > nLeft And nPixelX < nRight And _

nPixelY > nTop And nPixelY < nBottom Then

Mouse is within grid area

Dim nA As Long

Dim nX As Long

Dim nY As Long

Dim fX As Double

Dim fY As Double

nA = 0 'Initialize nA if using MultiAxesSubsets

nX = nPixelX 'Initialize nX with pixel location

nY = nPixelY 'Initialize nY with pixel location

Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, False, False, False

Form2.Caption = Str$(fX) + " - " + Str$(fY)

Else

Form2.Caption = "Outside Grid"

End If

 

End Sub