LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strip chart with left and right axis...

Hello all,
I'm trying to use a strip chart with one trace on the left axis and one on
the right one.
I tried to iterate this:

SetCtrlAttribute (Pxy, XY_STRIPCHART, ATTR_ACTIVE_YAXIS,
VAL_LEFT_YAXIS );
PlotStripChartPoint (Pxy, XY_STRIPCHART, LeftY);

SetCtrlAttribute (Pxy, XY_STRIPCHART, ATTR_ACTIVE_YAXIS,
VAL_RIGHT_YAXIS );
PlotStripChartPoint(Pxy, XY_STRIPCHART, RightY);

But I see only one sawtooth trace that alternates between the two values.
Also the strip goes twice too fast.

What is the trick ?
--
Guillaume Dargaud
http://www.gdargaud.net/Climbing/Madagascar.html



0 Kudos
Message 1 of 4
(3,984 Views)

Hi Gillaume,

 

You have a couple of problems:

 

1. If you have more than one trace in the chart, you can't use PlotStripChartPoint. Whenever data is plotted on the chart, the data points that you pass in are distributed among all the traces in the chart. So, if you have two traces, you need to plot at least two points at a time, otherwise, nothing happens, because the modulo is discarded. For example, if you plot 7 points at a time, and you have 3 traces, then 2 points are added to each trace and the 7th point is discarded. This means that if you have two traces, you need to use the PlotStripChart function instead.

The fact that you are seeing data being plotted tells me that you haven't yet set up a second trace in the chart. This is something you have to do ahead of time, prior to plotting. You can either do it in the UI Editor  (click on the Traces button in the Edit Strip Chart dialog) or programmatically using ATTR_NUM_TRACES. And if you haven't set up a second trace, then each time that you plot a point, that point goes to the first (and only) trace, which is probably why you're seeing the chart scroll twice as fast.

 

2. The way you plot using the right y-axis versus the left y-axis is different between graphs and charts. With a graph, you do have to set the active y-axis before you plot. But with the chart, since you have to create the traces ahead of time, then you simply associate each trace with an axis just once. You can also do this in the UI Editor, or programmatically using the ATTR_TRACE_YAXIS trace attribute (SetTraceAttribute).

 

Finally, I need to point out that a second y-axis was only added to the strip chart in version 8.5 of CVI. Therefore, if your plan is to port this app to Linux, you won't be able to use it until an updated version of the CVI Linux module comes out (the current version is based on CVI 8.0, as you know).

 

Luis

Message 2 of 4
(3,978 Views)

Hi Guillaume,

 

based on the last notice of Luis response, I can suggest you an alternative way of faking a second Y-axis on your control: this is described in my Multi axis graph in CVI example and even if described there on graphs it can be applied to strip charts too; moreover, since it does not uses any 8.5 release feature you should have no problems in port it on Linux.



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 3 of 4
(3,958 Views)
Thanks Luis and Roberto,
That's the only detailed explanation I've seen on how to use 2 axes on strip
charts.
I'd rather use this method than the workaround, even if that means waiting
to the next Linux version... which can't be far around the corner. Right
guys ?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 4 of 4
(3,953 Views)