LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

new message

          

            Hello, I'm trying to draw an x-array and a y-array using ploXY function; but an inclined line is composing on my graph. I'm using that code:

 

plot_handle = PlotXY (testler, TESTLER_GRAPH, inputNumber, amplitude, 1024, VAL_INTEGER, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_DOT, 1, VAL_RED);    

 

           In this code, inputNumber is an integer, amplitude is a double value. I'm drawing a point in the each 'for' loop using the plotXY in the above; but an inclined line that is between 0 and the last produced point, is also composing together with my correct points.

           

           How can I prevent this inclined line? 

 

0 Kudos
Message 1 of 7
(4,489 Views)

Hello,

 

I am not sure if I understand you correctly but you should provide data arrays, not individual points: PlotXY will plot all the data in the two arrays by itself, you do not need an extra loop. So inputNumber should be an array of integers: inputNumber [ 1024 ].

0 Kudos
Message 2 of 7
(4,486 Views)

 

         I want to draw my graph instantly. I take my data from e3631a dc power supply. I can draw the graph after obtaining my all data; but I want to draw my graph simultaneously while taking my data from e3631a. During drawing this graph, I'm encountering unexpectedly with an inclined line from 0 to the value that is read in current.

        What can I do to avoid this unexpected line?

       

        The following is a part of my code:      

 

 

double sonuc;
int plot_handle;
int CVICALLBACK CBBasla (int panel, int control, int event,
       void *callbackData, int eventData1, int eventData2)
{
 FILE *fp;
 switch (event)
 {
  case EVENT_COMMIT:
   int i;
   
   fp=fopen(fileName,"a");
   fprintf(fp,"\n\n Input Number     Amplitude      Upper Level     Lower Level   Status\n\n");
   
   for(i=0;i<1024;i++)
   {
    hpe363xa_queryOutputCurr3631 (vi, 1, &sonuc);
    lowerlevel[i]=-3;
    upperlevel[i]=3;
    
    amplitude[i] = sonuc;
    if (amplitude[i] > upperlevel[i] || amplitude[i] < lowerlevel[i])
    {
     status[i]='F';
    }
    else
    {
        status[i]='P';
    }
    
    fprintf(fp,"   %d        %9.5f       %9.5f       %9.5f        %c\n",inputNumber[i], amplitude[i], upperlevel[i], lowerlevel[i], status[i]);
    inputNumber[i]=i+1;
    
    plot_handle = PlotXY (testler, TESTLER_GRAPH, inputNumber, amplitude, 1024, VAL_INTEGER, VAL_DOUBLE, VAL_SCATTER, VAL_EMPTY_SQUARE, VAL_DOT, 1, VAL_RED);
   
       
   }
   
   
   fclose(fp);
   
   break;
  case EVENT_RIGHT_CLICK:

   break;
 }
 return 0;
}

0 Kudos
Message 3 of 7
(4,479 Views)

If you really want to update your graph so many times (note that it might slow down your data acquisition) you only should plot the data you have acquired, i.e., use something like

plot_handle = PlotXY (testler, TESTLER_GRAPH, inputNumber, amplitude, i+1, VAL_INTEGER, VAL_DOUBLE, VAL_SCATTER, VAL_EMPTY_SQUARE, VAL_DOT, 1, VAL_RED);

 

Right now you are plotting all 1024 data points, even if you have measured only 5 - the other data values probably are zero, and because you are plotting all of them, you see a line to ( 0, 0 ).

0 Kudos
Message 4 of 7
(4,475 Views)

Hi Eren.

 

is your problem solved?

 

If no, what's missing?

If yes, good Smiley Happy Then please mark the appropriate answer as solution.

0 Kudos
Message 5 of 7
(4,458 Views)

There is always the good old way, maybe not brilliant but working Smiley Wink

 

oldX = 0.0; oldY = 0.0;
while (condition) {
	// Acquire new measures
	// Values stored in X, Y variables
	PlotLine (..., ..., oldX, oldY, X, Y, ...);

	// Save last values acquired
	oldX = X; oldY = Y;
}


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 7
(4,448 Views)

         Hi Wolfgang,

         I solved my problem with your solution. Thank you vey much.

         Regards.

0 Kudos
Message 7 of 7
(4,439 Views)