LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can x-axis be a non fixed step in real time plots?

I want to plot position(x-axis) vs sensor intensity(y-axis) in "real time" as the data is being collected.
My problem is that the position step size varies from reading to reading. It seems strip charts will only
plot the x-axis with the same fixed increment.

Is this correct?
Is there a way for me to produce the plot I want using LabWindows?
0 Kudos
Message 1 of 4
(3,505 Views)
You're right, strip chart displays only fixed steps in X-axis, so it'n not practical in your application.

Could you move to standard graph control? Your control loop could look this way:

//Save first measure
xold = ...; yold = ...;

while (condition) {
// Acquire measures
xnew = ....
ynew = ....

// Display graph
PlotXY (...., xold, yold, xnew, ynew, ...);

// Save measures for the next step
xold = xnew; yold = ynew;
}

Shifting x-axis like a strip chart does can be difficult to obtain: could you replace it by repainting a new screen after the previous has completed? This method implies to clear all plots at the end of a screen, modify x-axis range and restart plotting with the method above.

Hope these suggestions can help you
Roberto


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 2 of 4
(3,491 Views)
Hi ejv,

Does your instrument pan back and forth as it scrolls (like a plotter or ink jet printer)? Or is this just a single data collection pass per test? I don't know if you are moving a microscope slide or if you are looking for a defect in a 30 foot long sheet of material. But an additional option might be possible.

If the sampling return rate changes, you should know or be able to predict the 'fastest' possible return rate by the properties of your data collection system. If you don't need super accurate plotting (and if you have a little iron on your server with nothing else to do) you might be able to configure the strip chart for plotting at the 'fastest' or greater than 'fastest' rate. Then, use an async timer or something similar to re-sample your intermittent return values on a continuous time scale.

For example, if your fastest sample return is 0.1 seconds, plot to the strip chart 10 times per second (or more). If a value doesn't change for 0.71 seconds, then just plot the same value 7 times, and then plot the new value on the 8th sample. Of course, if your re-sample interval is too large, you will fail to plot some values. This may not work for you, but I have done similar things in the past.

If you do want to try this, I would suggest that you make a wide strip chart with a very high x-range (maybe 200 intervals), and set your strip chart to sweep. It will take some getting used to but this requires a lot less redrawing on the screen. Think of the amount of screen turf that has to be updated. The wider the x-range intervals are, the more number of pixels may need to be redrawn. Taller plots also mean more pixels to redraw. If you really want to know your capabilities, first write a CVI sample app that plots to the strip chart as fast as you can for 10 seconds. When you get it to sweep the way that you like, figure out how many times a second that you are plotting. Drop your speed down just a bit more for your production system because you may need extra CPU to do pre-processing or post-processing.

Orlan
0 Kudos
Message 3 of 4
(3,478 Views)
ejv,

I have had to do something similar to what Roberto suggested before and I found that using the PlotXY can cause a pretty severe flicker depending on the amount of times you do it per second and also the amount of points you are graphing. If you find flickering you may want to set the 'ATTR_SMOOTH_UPDATE' control attribute to TRUE. I have found that setting the 'ATTR_ANTI_ALIASED_PLOTS' to TRUE also works very well to reduce flickering but takes up a lot of CPU.
0 Kudos
Message 4 of 4
(3,472 Views)