LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

X coordiante of last point added to strip chart

Hello all,
how can I get the X-axis coordinate of the last point added to a strip
chart?

Sure, I could count the number of times I call PlotStripChart, but is there
an attribute for that ?
--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 1 of 11
(3,761 Views)

Sorry Guillaume, there's no straightforward way to do that. You'd have to remember the last point you plotted, taking into account the gain and offset of the axis.

 

Luis

0 Kudos
Message 2 of 11
(3,758 Views)
Hi LuisG,

> Sorry Guillaume, there's no straightforward way to do that. You'd have to
> remember the last point you plotted, taking into account the gain and
> offset of the axis.

It's apparently more complicated than that, because if I change the PPS (and
who knows what else), then the count is off (reset to 0 probably). I would
suggest to add this as an attribute for a future version.
--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 3 of 11
(3,750 Views)
Still about strip charts, a related question.
Can I keep adding text axis items 'ad infinitam' with InsertAxisItem or do I
need to clena up those who 'fall out' of the plot with DeleteAxisItem

In other words, does it slow down the plot and slowly fill up the memory, or
does the plotting library take care of it ?

Is there a maximum amount of text axis items ?

Thanks.
--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 4 of 11
(3,747 Views)
Responding to myself here.
So counting the calls to PlotStripChart works in Continuous mode, but it
doesn't in sweep or block.
After the screen has been filled, new points are added to the left while the
axis items are added to the right, so the plot is invisible except for the
last point barely on the left (see screenshot).

Why is the behavior different in sweep and block scroll mode ? ?
--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 5 of 11
(3,745 Views)

To answer your previous question, there is no limit to the number of axis items that you add, but there's also nothing in the chart to automatically purge items that are not in view (since the axis max/min can change, or the chart can be scrolled back and forth, in which case you'd want the axis items to still be there). Therefore, I definitely recommend that you explicitly remove them when you think it's safe to do so, otherwise memory use will increase over time.

 

I don't completely understand the difference that you're talking about with sweep and block modes (you forgot to attach the screenshot, by the way, maybe that would have made it clearer).

 

In sweep and block modes, the chart advances one "page" at a time, instead of advancing only the amount that is necessary to acommodate the new data. However, the new data is plotted in accordance with the numeric values in the x-axis and the axis item is placed in the location that corresponds to its numeric value in the axis. So, I don't understand what you mean when you say that the "axis items are added to the right".

 

You also mentioned that counting the calls to PlotStripChart doesn't work in sweep mode. But let's take a look at a simple example:

 

Assuming, for the sake of simplicity, that your gain is 0, your offset is 1, your pps is 100, and you always plot 1 point at a time...

 

After 110 plotting calls, your last x-value is 109, regardless of whether you're using continuous or sweep modes. The only difference is the pixel location of this data point on the chart: in continuous mode, it's all the way on the right side of the chart (the x-axis range is 10-109), whereas in sweep and block modes, it's close to the left side of the chart (the x-axis range is 100-199). But this is still the x=110 value, in all cases. And if you have a label string that corresponds to 110, that's also where that label string appears, in all cases.

 

What am I missing?

 

Luis

0 Kudos
Message 6 of 11
(3,740 Views)
Hello Luis,

> To answer your previous question, there is no limit to the number of axis
> items that you add, but there's also nothing in the chart to automatically
> purge items that are not in view (since the axis max/min can change, or
> the chart can be scrolled back and forth, in which case you'd want the
> axis items to still be there). Therefore, I definitely recommend that you
> explicitly remove them when you think it's safe to do so, otherwise memory
> use will increase over time.

That's good to know. Thanks.

> I don't completely understand the difference that you're talking about
> with sweep and block modes (you forgot to attach the screenshot, by the
> way, maybe that would have made it clearer).

I posted from the Usenet portal, and it must have stripped the attachment...
And today I can't use the web interface (Error 310 ERR_TOO_MANY_REDIRECTS,
see other post) to post it again.

Anyway, I have the same problem with the NI stripchart.cws example. The
strip chart flickers and only displays 2 points on the left of the area in
sweep and block mode. But if I compile them on Linux they WORK FINE !

Here it is: http://www.gdargaud.net/BugFest/stripchart.png

So I'm thinking some kind of weird graphic driver bug on my development
machine... I'm using 10.0.0 (360)


--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 7 of 11
(3,717 Views)

Hello Guillaume, may you be running into this problem?



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 8 of 11
(3,709 Views)

I'm not sure I follow what you are having trouble with either. The screenshot you posted looks like the correct behavior for sweep mode. Is it correc that you are suggesting there is a difference in behavior between the chart on Windows and Linux? Could you post the equivalent Linux screenshot?

 

Are you still trying to get the last value plotted? Could you not maintain this in a variable rather than pulling the information from the chart? By that I mean, each time you plot data, grab the last value in the data setting you are adding and save it in a global variable.

National Instruments
0 Kudos
Message 9 of 11
(3,698 Views)

I apologize, I misunderstood what you had in the screenshot. Roberto is correct that we did patch this for 2010 and the latest version of the CVI 2010 Run-Time Engine can be downloaded by following the link Roberto provided or here. The reason the strip chart looks correct in Linux is because we caught the problem before releasing the Linux module.

National Instruments
0 Kudos
Message 10 of 11
(3,688 Views)