LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

annotation problem

Hi,

 

I am having a problem with the placement of an annotation on a xy graph (CVI 9).

 

In the GUI editor, the annotation is assigned to the right y axis. The first time I set the annotation (visible, x-position, y-position) it appears where it is supposed to.

 

Then I hide it, rescale tha graph etc. The second time the annotation is displayed, it is at the correct x-position, but not at the correct y-position, that I set using SetAnnotationAttribute ( panel, graph,6,ATTR_ANNOTATION_YVALUE,threshold ). I am plotting a line at the same y value which appears at the correct place, so I know that the y-value itself is fine. Only the text position is odd, sometimes too high, sometiems too low. So I assuem that it depends somehow to the fact htat it is assigned to the right y-axis, because the x-axis works... I have tried to find the bug in my code but so far I failed.

 

Therefore I'd like to ask if there is another attribute I have to set simultaneously to make it work as expected?

 

The sequence is as follows: SetAnnotationAttribute (ATTR_ANNOTATION_VISIBLE,), then SetAnnotationAttribute (ATTR_ANNOTATION_YVALUE), and then SetAnnotationAttribute (ATTR_ANNOTATION_XVALUE). After that, data are plotted, the graph is set to refresh etc.

 

Thanks!

 

Wolfgang

0 Kudos
Message 1 of 3
(3,100 Views)

Hi,

 

it appears to be a problem/bug that is connected with the autoscaling of the right y-axis: if the right y-axis ist set to manual scaling, the annotation appears at the correct y-position; if, however, the y-axis is permitted to autoscale, the annotation position is not correct...

 

Here is the sample code (two times identical except the y-scaling attribute of the right y-axis):

 

wrong y-position of annotation:
 
SetCtrlAttribute ( ATTR_REFRESH_GRAPH, 0 );
SetAxisScalingMode ( VAL_BOTTOM_XAXIS, VAL_MANUAL );
GetAxisScalingMode ( VAL_LEFT_YAXIS );
SetAxisScalingMode ( VAL_LEFT_YAXIS,VAL_MANUAL );
SetCtrlAttribute ( ATTR_ACTIVE_YAXIS, VAL_RIGHT_YAXIS );
SetCtrlAttribute ( ATTR_YLABEL_VISIBLE, TRUE );
SetCtrlAttribute ( ATTR_ACTIVE_YAXIS, VAL_LEFT_YAXIS );
SetAxisScalingMode ( VAL_RIGHT_YAXIS, VAL_AUTOSCALE );
PlotXY (  );
SetPlotAttribute ( ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS );
PlotXY (  );
SetPlotAttribute ( ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS );
SetAnnotationAttribute ( ATTR_ANNOTATION_VISIBLE, 1 );         
SetAnnotationAttribute ( ATTR_ANNOTATION_YVALUE );
SetAnnotationAttribute ( ATTR_ANNOTATION_XVALUE );
GetCtrlAttribute ( ATTR_NUM_PLOTS );
SetPlotAttribute ( ATTR_PLOT_ZPLANE_POSITION );

 

does work as expected:

 

SetCtrlAttribute ( ATTR_REFRESH_GRAPH, 0 );
SetAxisScalingMode ( VAL_BOTTOM_XAXIS, VAL_MANUAL );
GetAxisScalingMode ( VAL_LEFT_YAXIS );
SetAxisScalingMode ( VAL_LEFT_YAXIS,VAL_MANUAL );
SetCtrlAttribute ( ATTR_ACTIVE_YAXIS, VAL_RIGHT_YAXIS );
SetCtrlAttribute ( ATTR_YLABEL_VISIBLE, TRUE );
SetCtrlAttribute ( ATTR_ACTIVE_YAXIS, VAL_LEFT_YAXIS );
SetAxisScalingMode ( VAL_RIGHT_YAXIS, VAL_MANUAL );
PlotXY (  );
SetPlotAttribute ( ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS );
PlotXY (  );
SetPlotAttribute ( ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS );
SetAnnotationAttribute ( ATTR_ANNOTATION_VISIBLE, 1 );         
SetAnnotationAttribute ( ATTR_ANNOTATION_YVALUE );
SetAnnotationAttribute ( ATTR_ANNOTATION_XVALUE );
GetCtrlAttribute ( ATTR_NUM_PLOTS );
SetPlotAttribute ( ATTR_PLOT_ZPLANE_POSITION );

Regards, Wolfgang

0 Kudos
Message 2 of 3
(3,081 Views)

Hello Wolfgang,

 

I've tried to reproduce this problem using your code fragments with some values that I made up, but I couldn't reproduce it. There must be some other factors that need to be present in order for this to happen, or maybe the values need to be different

 

I'm attaching the files that I used. If you can reproduce it in your computer using my files, then we'll have to focus on some possible system configuration differences. If you also can't reproduce it with my files, please see if you can modify them to be more similar to yours.

 

Thanks,

Luis

Download All
0 Kudos
Message 3 of 3
(3,050 Views)