LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with using Graph Controls

Hallo all,

I've some problems with programming graph controls in CVI. I'm measuring data with 10,000 Hz and write this data seperated by an semicolon into an *.txt file. After the Measurement, I want to visualize the data with an graph control. The problem is, when I read one Value from the File, CVI can not draw a "thin Line" so I have to use "connected point" what I want to avoid.
I thought I can take a hand full of data e.g. 50 samples and draw a graph with "thin line". This was the idea.
Here is my code:
while (stop == 0)
{
    for(count=0; count<50; count++)
    {
        end = fgets(puffer, 100, MESS_FILE);
   
        if (end == NULL)
        {
            stop = 1;
        }

       
        if (stop == 0)
        {
            pch = strtok (puffer, ";");
            graph_x[0] = atof(pch);
           
            pch = strtok(NULL, ";");
            graph_y_s[0] = atof(pch);
        }
    }
           
    PlotXY (handle_panel_graph, PANEL_PLOT_GRAPH_2, graph_x, graph_y_s, count-1, VAL_DOUBLE, VAL_DOUBLE, VAL_CONNECTED_POINTS,
            VAL_ASTERISK, VAL_SOLID, 1, VAL_RED);
       
}

How can I solve the problem on a better way?


Greets from germany
0 Kudos
Message 1 of 6
(3,830 Views)

Maybe you can use  PlotWaveform...

 

0 Kudos
Message 2 of 6
(3,796 Views)
You could use the functions ArrayToFile() and FileToArray() (from the Formatting and I/O Library) to save and retrieve the data.

0 Kudos
Message 3 of 6
(3,790 Views)
You should be able to plot thin line only with this:
 
PlotXY (handle_panel_graph, PANEL_PLOT_GRAPH_2, graph_x, graph_y_s, count-1,
            VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE,
            VAL_NO_POINT, VAL_SOLID, 1, VAL_RED);
0 Kudos
Message 4 of 6
(3,746 Views)
Both, PlotWaveform and PlotXY works, but there is the next problem:

When reading always for example 10 data samples from file, I can Plot a waveform with 10 elements from x=0 to x=9, wen I read the next 10 samples, the waveform from x=10 to x=19 are plotted, but the points x=9 and x=10 (the last of first wave and first of second wave) are not connected. How can I do this?
0 Kudos
Message 5 of 6
(3,683 Views)
In both case you could add a point before the first measure of the second plot, that is plot 11 points instead of 10, conveniently adjusting initial x field in case you are using PlotWaveform.


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 6
(3,680 Views)