LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph - X Axis Time value

Hi folks! I am in trouble ploting some graphs.

I plot a graph and it is configured to have 500 points per screen.

I set some graph option using these commands:
    SetCtrlAttribute(panel, control, ATTR_XAXIS_OFFSET, startTime);
    SetCtrlAttribute(panel, control, ATTR_XFORMAT, VAL_RELATIVE_TIME_FORMAT);

To plot I use this command:
    PlotStripChart (panelID, controlID, pValue, NofTraces, 0, 0, VAL_DOUBLE);

The configuration of the strip chart is:
Scrool mode: Sweep

The problem is that CVI assumes by itself that the frequency that is receive the data is 1Hz. I would like to know if does CVI Strip Chart work with relative time.

For example, it has its internal clock. If my chart receives 10 samples in the first second all of these samples must be plotted in the time slice between 0s to 1s. If I receive 5 samples during the another second, all these data must plotted during the period that is was reveived.

Could anyone help me?

Thank you in advance.
0 Kudos
Message 1 of 6
(4,000 Views)
One simple approach would be to arrange for the strip chart plotting to occur on a Timer callback, at a regular rate, with plotted points taken from a global array. As your asynchronous data arrives, simply write it into the same global array. That way, even if your data source dries up, the strip chart will continue at the same rate. Just make sure your timer callback rate is sufficiently fast not to miss your input data rate. A refinement would be to implement a FIFO buffer or queue instead of a simple array, between data reception and data plotting.
 
JR
0 Kudos
Message 2 of 6
(3,994 Views)
Does CVI not provide any easy solution that can be implemented? I hope that this feature should be implemented automatically by CVI.

Thank you in advance.
0 Kudos
Message 3 of 6
(3,992 Views)
If your sampling rate were uniform, then there is a simple solution that you could use -- you can change the gain of the strip chart to match your sampling rate. For example, if you edit the chart in the UI editor, and you change the display format to "relative time", you can see a drop-down ring next to the 'gain' control. This ring has some other time units to use besides seconds. However, you're not limited to one of these units. In your case, if your sampling rate is 10Hz, you would simply set the gain to 0.1 and the time axis should match up with your data.

Of course, it sounds like your sampling rate can vary. In that case, things become a bit more complicated. The strip chart assumes that the data is uninformly spaced with respect to time. In that case, my suggestion would be to set the gain to the fastest rate that you know you will have, and when the sampling rate slows down, you'll have to fill in your data array with repeated values (or interpolated values, if you prefer) in order to fake the higher frequency.

Luis
0 Kudos
Message 4 of 6
(3,981 Views)
Luis, when were these features added to the StripChart control? I can't see them in my CVI 7.0.0 UI editor.
 
JR
0 Kudos
Message 5 of 6
(3,964 Views)
Hello, JR.

They were added in version 8.0.

Luis
0 Kudos
Message 6 of 6
(3,951 Views)