LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I fix the width of my CVI Graph border.

I am using LabWindowsCVI 7.0 to display a continuously updating graph.
When the values on the Y-axis update, the graph area expands or contracts
horizontally as the width of the Y-axis values changes. How can I specify
a fixed width border so that the graph remains a constant width?

I have tried fixing the format of the Y-axis values using the ATTR_YPADDING
attribute but this simply pads the number out with leading zeros which is
not what I want.

Thanks,
Darren

Message Edited by Darren Draper on 06-24-2005 05:39 AM

0 Kudos
Message 1 of 4
(3,583 Views)
I don't know of any mean to fix Y-axis labels width. When I don't want the graph to dynamically resize due to different Y-axis width usually I use two different graphs one on top of the other: the one to the back has transparent plot area, no x axis and no grids (it's used only to display the Y-axis). The one to the front has all elemnts visible except the Y-axis. By providing enough space for the Y-axis of the background graph you obtain a fixed-width plot area. Obviously, the two graphs must be set the same Y-axis scale...

You can see an example of this in my response to this question: simply hide the Y-axis of the graph to the front and you're ready!

What you are missinig with this approach is the automatic update of the second graph: in your process you'll need to periodically get Y-axis scale and set the background graph to these values. Of course this can introduce a significant delay bethween graph and scale adjustment: you will see if this is acceptable in your app. Or you can disable autoscaling and look to autostrp.prj sample project that simulate autoscaling on a strip chart.


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?
Message 2 of 4
(3,565 Views)
Darren,

Try using the following function (assuming you are using a graph and not a strip chart). It will set your graphs Y Axis to the desired static values:

/*Set the graph control left y axis to a minimum of 'min' and a maximum of 'max'
SetAxisScalingMode (Panel, control, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
Message 3 of 4
(3,560 Views)
Hi Dave,

I need my graph Y-axis set for autoscaling, so setting min and max values isn't suitable.

It's the physical width of the Y-axis border that I want to control.... i.e. I'd like to be able to give the graticule a fixed width. Instead the graph control is given a width, and then within the graph itself the graticule and Y border shift about in the horizontal plane depending upon the size of the numbers displayed up the Y-axis.

In a similar VB application, using a Meas Studio CWUI Graph, I can control the width of the border by specifying the format of the y-axis numbers to be a maximum number of digits. However, a similar feature doesn't appear to exist with CVI Graphs (the nearest thing is setting the PADDING attribute, but that simply pads out the Y-axis numbers with leading zeros, which I don't want).


Thanks,
Darren
0 Kudos
Message 4 of 4
(3,554 Views)