Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Accounting for the Shifting Y Axis in Graphs and Charts

15 ratings | 3.87 out of 5
Print
In LabVIEW, you can change the range of an axis scale during run-time. Graphs show the entire scale label by reducing the plot area size. You might not want this functionality. For example, when comparing signals with multiple graphs, you want to keep the plot area size consistent between the two no matter the amplitude of the signals. In the following example, the plot size varies depending on the size of the maximum value you select for the Y scale. This is due to the amount of horizontal space that is needed to display the numerical values of the Y axis. In XY Graph 2, the Y scale uses larger number than in XY Graph, so the plot area decreases in XY Graph 2 but the overall size of the graph remains the same.


Figure 1


You can solve this problem in two ways. First, you can use a Property Node to set the Plot Area:Size property to a constant value. This solves the problem of the shrinking plot area size, but because the plot size remains constant, the entire graph expands to accommodate for the scale label size change. In the following example, the plot area size remains constant between XY Graph and XY Graph 2, but XY Graph 2 increases in size to accommodate for the plot area.


Figure 2


You also can add a config token to the labview.ini file in the same directory as labview.exe. Open labview.ini, add the line EnableAutoScales=False, and save the file. Restart LabVIEW for your changes to take effect. With this config token, the Y axis does not shift horizontally, as shown in the following example. The overall size of the graph and the plot area size stays constant, but LabVIEW crops the Y scale values if they are too wide.


Figure 3


A third way to adjust for the scale label size is to use property nodes to resize the plot area and then reposition the graph. Combine this with using a front panel decoration as the graph "perimeter" will give the illusion that the graph as a whole maintains a constant size while also maintaining the size of the plot area. Please see the link below for more information on this.

A fourth way to adjust for the scale label size is to simply set the Format and Precision of the Y axis to use scientific notation and a set amount of significant digits. Also, remember to uncheck the Hide trailing zeros option for more consistency.

Related Links:
Programmatically Locking Graphs in a Fixed Position

15 ratings | 3.87 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).