LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Binding Cursor with particular plot

Hi,
 
I have ploted 6 plots on graph control and added 6 cursors. I want to bind the each cursor to particular plot, so that  I can display 6 X and Y pairs on UI.
Any suggetion will be very heplful to me.
 
Gajanan
0 Kudos
Message 1 of 6
(3,557 Views)

Hello Gajanan,

There isn't a function to restrict the cursor to a particular plot.  You will have to do this programmatically.  You can get the ID of the plot the cursor is currently over (if it is a snap-to-point cursor) with the GetGraphCursorIndex (panel, PANEL_GRAPH, eventData1, &plothandle, &index) function.  The ID of the cursor that was moved will be passed in the eventData1 parameter.  If the plotHandle is not the plot you want the cursor associated with, you can choose not to display the X/Y coordinates of the cursor on the UI and reset the cursor to a default location on a specified plot with the SetGraphCursorIndex function.

For instance, if you create two cursors and you want cursor 1 to be associated with plot 1 and cursor 2 to be associated with plot 2, you could do something like this:

        /* Get the cursor's position */
        GetGraphCursor (panel, PANEL_GRAPH, eventData1, &x, &y);
       
        /* Figure out which plot and which point the Cursor is over */
        GetGraphCursorIndex (panel, PANEL_GRAPH, eventData1, &plothandle, &index);
       
        if (plothandle == eventData1) {
         /* Display the data */   
         SetCtrlVal (panel, PANEL_XREADOUT, x);
         SetCtrlVal (panel, PANEL_YREADOUT, y);
         SetCtrlVal (panel, PANEL_INDEX, index);
         printf("E1: %d, x: %f, y: %f, index: %d, plotHandle: %d\n",
           eventData1, x, y, index, plothandle);
        } else SetGraphCursorIndex(panel, PANEL_GRAPH, eventData1, eventData1, 0);

 

Thanks.

 

 

Message Edited by Wendy L on 07-18-2005 03:18 PM

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 6
(3,545 Views)

Thanks Wendy.

 

0 Kudos
Message 3 of 6
(3,530 Views)
hello,

I would like to plot  a   XY graph with small text near by plotted points .Ofcourse I tried with PlotText ()
but  it takes much time to display text with each point  in the graph. Is it possible to  plot XY graph with  text at each point   ???

I am reading a binary file  which has an array with many elements (approx. more than 1 million)(each element of this arrray is a structure)
 for example  first element of  myarray is  myarray[ 0]. x,   myarray[0].y,     myarray[0].text1,   myarray[0].text2

I am reading the file element by element until the end of file and copying the values  to different arrays for plotting a graph
   For ex:  first elements of different arrays              Xarray[0]= myarray[ 0]. x
                                                                                 Yarray[0]= myarray[ 0].y
                                                                                Text1array[0][50]= myarray[ 0].text1
                                                                                Text2array[0][50]= myarray[ 0].text2
Now I am using PlotPoint and PlotText for plotting XY graph with empty square points and for displaying my texts at each point  (text1 , text2 of my Textarrays) inside the reading  loop ( reading binary file ).
It is very slow if I use these PlotPoint and PlotText inside the reading loop.
I tried with PlotXY   to plot XY graph with empty square by giving Xarray and Yarray (after finishing the reading  binary file ). It  is very fast  if I use only  PlotXY(without displaying text at each point). But now  I am still using PlotText  inside the reading file routine(for displaying text at each point). So  it is again very  slow  because of  PlotText inside  reading routine.
Is it possible  to display text at each point at a time( like PlotXY )  by giving Xarray , Yarray  and Text1array
Text1array[ ][ ] =   {   "xyz"
                                 "abc"
                                  "def"
                                  .......
                                   .......    }       

  "xyz" at  first point , "abc" at second point , so on............
    Any suggessions...................???

0 Kudos
Message 4 of 6
(3,528 Views)

Hello rajj,

Refer to the following post.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 6
(3,506 Views)
Hello raj1,

maybe it should help, if you make the graph invisible with SetCtrlAttribute (panelHandle, controlID, ATTR_VISIBLE, 0) and then plot all the points and text. After plotting, you make the graph visible with SetCtrlAttribute (panelHandle, controlID, ATTR_VISIBLE, 1).
This should accelerate the plot.

Best regards,

Martin
0 Kudos
Message 6 of 6
(3,467 Views)