GRAPH.AddElement

Previous  Next

 

nNewElement = GRAPH.AddElement( BYVAL nControl AS INTEGER,

                                BYVAL name     AS STRING,

                                BYREF x_data   AS ARRAY,

                               [BYREF y_data   AS ARRAY=NULL] ) AS INTEGER

 

nNewElement = GRAPH.AddElement( BYVAL nControl AS INTEGER,

                                BYVAL name     AS STRING,

                                BYREF x_data   AS ARRAY,

                                BYVAL x_vixa   AS INTEGER

                               [BYREF y_data   AS ARRAY=NULL],

                               [BYVAL y_vixa   AS INTEGER=0]  ) AS INTEGER

 


 

Create a new element using the supplied data.  In the first syntax, each ARRAY is a one dimensional array.  You can use the slice function V1D to create the one dimensional array from a multidimensional array.  If the created graph is a NT_XT graph, only one array is needed.  For a NT_XY graph, the first array will be plotted against Axis 1 and the second array will represent Axis 2.

 

In the second syntax, you can supply multi-dimensional arrays and specify the desired vector using a Vector Index Array.  Just like in the first syntax, only one array is required for a NT_XT graph.

 

The return value from the function is the element number created.  Note that element numbers start at 1.  If failed, then 0 is returned.

 

Example 1:

 

DIM nElement AS INTEGER

DIM pos3d_file( 60, 4, 3 ) AS REAL  ' 3D Data

DIM pos_x( 60 ) AS REAL             ' 1D Vector, X Data

DIM pos_y( 60 ) AS REAL             ' 1D Vector, Y Data

 

' Use V1D to extract the X and Y vectors from the pos3D_file array

nElement = GRAPH.AddElement( nControl, "Marker 1", V1D( pos_x, pos3D_file, 1, 1 ), V1D( pos_y, pos3D_file, 1, 2 )

 

Example 2:

 

OPTION BASE 1

 

' Note;  Array will have X/Y/Z Data + Resid and Camera Mask

DIM fourP( nFrames, 4, 5 )

 

' Read Point 1 into first point index

C3D.GET_3D_POINT_ARR( hFid, 1, REF( fourP ), C3D_ITEM_ALL, 1 )

 

' Plot the X/Z data for Point 1

GRAPH.AddElement( hGraph, "Point 1", fourP, VIX( 1, 1 ), fourP, VIX( 1, 3 ) )