LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Left/Right axis strip chart

Hello all,

I know double axis issues are often discussed here, but I can't seem to get
it right.

So if I want a strip chart with 8 traces, the first 4 using the left axis,
the other 4 using the right one, I should do:
SetCtrlAttribute (Pxy, XY_STRIPCHART, ATTR_NUM_TRACES, 8);
SetTraceAttribute (Pxy, XY_STRIPCHART, 1, ATTR_TRACE_YAXIS,
VAL_LEFT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 2, ATTR_TRACE_YAXIS,
VAL_LEFT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 3, ATTR_TRACE_YAXIS,
VAL_LEFT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 4, ATTR_TRACE_YAXIS,
VAL_LEFT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 5, ATTR_TRACE_YAXIS,
VAL_RIGHT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 6, ATTR_TRACE_YAXIS,
VAL_RIGHT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 7, ATTR_TRACE_YAXIS,
VAL_RIGHT_YAXIS);
SetTraceAttribute (Pxy, XY_STRIPCHART, 8, ATTR_TRACE_YAXIS,
VAL_RIGHT_YAXIS);

Then I add a new set of points to the chart:
double Y[8];
[...]
PlotStripChart(Pxy, XY_STRIPCHART, Y, 8, 0, 0, VAL_DOUBLE);

Well, no luck, they all use the right axis.
What am I missing ?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 6
(3,879 Views)
Well, it gets worse:

> [...]
> PlotStripChart(Pxy, XY_STRIPCHART, Y, 8, 0, 0, VAL_DOUBLE);

for (i=1; i<=8; i++)
GetTraceAttribute (Pxy, XY_STRIPCHART, i+1, ATTR_TRACE_YAXIS, &Side);

Side is always 1, which is VAL_LEFT_YAXIS, but the axis used is the right
one (=2) for all traces. Yes, both axes are visible and the auto-resize
tells me which axis is being used with clarity: if I send
{0,100,0,0,0,0,0,0} and the left axis stays unchanged 0..1 while the right
one goes 0..100, I'm sure trace 2 is on the right one.

Huh?

I'm on CVI 8.5 on Windows.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 2 of 6
(3,874 Views)
Sorry if I keep adding to the thread, but I'm wondering if this might be a
8.1/8.5 UIR issue.
The UIR file is in 8.1 format because I need to share it with a Linux
compile of the program. I know I can have only the left strip axis in Linux
(CVI 8.0) and I have the appropriate macros to ensure it.
But on Windows I'd like to be able to run with both axes. Is the fact that
the UIR is 8.1 blocking this ?

My tests indicate that this is not the case. If I save in 8.5, I get the
exact same return from GetTraceAttribute (... ATTR_TRACE_YAXIS ...);
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 3 of 6
(3,874 Views)

Hi Guillaume,

 

You're not doing anything wrong. Your code is correct. There was a bug in CVI 8.5 that caused the problem that you're seeing. This bug was fixed in 8.5.1, so if you want to get past this problem, I recommend that you download the 8.5.1 runtime engine.

 

You should be able to use the right y-axis even if you save the .uir file with the 8.1 format. However, if you save it in 8.1 format, any configuration that you made to the right y-axis in the UI editor will have been lost and you'll have to repeat them programmatically, using SetCtrlAttribute and SetAxisScalingMode (this is because the right y-axis was only added to the strip chart in version 8.5).

 

Luis

0 Kudos
Message 4 of 6
(3,859 Views)
Thanks Luis, that solved it.

Maybe that info should be on the
http://zone.ni.com/reference/en-XX/help/370051H-01/cvi/cviplotstripchart/
page as I searched the NI site extensively for a solution but had no hint
there was a bug reported for this problem, even less a patch.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 5 of 6
(3,827 Views)

You're absolutely right. There should have been a Knowledge Base article for this issue. I'll go ahead and create one now. I'm sorry about the wasted time that this caused you.

 

By the way, there was no patch for this bug. It was fixed in the next release of CVI, which happened to be 8.5.1.

 

Luis

0 Kudos
Message 6 of 6
(3,826 Views)