Example Code

Multiple Axis in a Graph Using LabWindows/CVI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Other

Code and Documents

Attachment

Download All

Overview

This program allows the user to plot multiple axis in a graph.

 

Description

Several application environments normally use multi-axis graphs to represent device characteristics or test results. Consider the usual representation of the characteristics of electric motors or alternators in automotive or industrial environments as an example. Since CVI native graphs have only 2 Y-axis available, I developed a solution to supply such representations in my applications. The solution makes no use of tools other than native CVI controls and code: no need for ActiveX or any other additional controls. I added additional graphs to my panels in which only the Y-axes are visible, all the rest being hidden or painted in transparent. To plot diagrams on the base graph and correlate these plots with the external axes I used some scaling on the data and the gain property of each axis used. This solution permits you to add how many additional axes you want to your graphs. Basically, arrays of data are scaled according to a normalization factor that permits having congruent scales on the various axes (1, 2, 5 succession is common in this respect but 6, 12, 18... succession is used too). Arrays are then plotted on the base graph and the scaling factor used on each of them is applied as the gain to the corresponding axis (either on the base graph on on supplementary axis) to permit correlation between a point on the graph and the corresponding engineering value. The result is a complex diagram that permits to describe a phenomenon in a single graph. The source code includes a sample set of data to demonstrate this technique. Available options in the application permit to show numeric data side by side with the graph and to experiment with different normalization factors. This example makes use of error-checking macros described in another example

 

Requirements

LabWindows/CVI 7.1 (or compatible)

Advanced Analysis Library 

 

Steps to Implement or Execute Code

  1. Run program
  2. Click on Load File Path Button
  3. Choose a .dat File. The attached zip File includes Characteristics.dat

Additional Information or References

1296.JPG

**This document has been updated to meet the current required format for the NI Code Exchange.** 

 



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?

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.