NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

Multi-axis graph in CVI

VERSION 5

Created on: May 22, 2007 3:58 AM by Roberto Bozzolo - Last Modified:  Jul 22, 2008 12:35 AM by WendyL


REQUIREMENTS:
Application Software: LabWindows/CVI Full Development System

Built-in graph control has only 2 y-axis. In some environments, however, multiple axis graphs are common to represent complex phenomena. This project provides an example of how to place additional axis around a graph control

 

Several application environments normally use multi-axis graphs to represent device characteristics or test results: as en example, consider the usual representation of the characteristics of electric motors or alternators in automotive or industrial environments.Since CVI native graphs have only 2 Y-axis available, I had to develop a solution to supply such representations in my applications. Splitting the diagrams in several graphs is not a fiable solution since engineers are accustomed to the compact representation, so I started thinking on how to add supplementary axis to my graphs.The solution I found makes no use of tools other than native CVI controls and code: no need for ActiveX additional controls to study and deploy to the customer. Instead, a little bit of work on the user interface and a few lines of code while plotting diagrams.Basically I added to my panels additional graphs 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 to have 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 is shipped with 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 sample of mine.Other requirements:

Advanced analisys library is required for the QScale1D function. Neverthelss, this function is just a scaling function on an array of data and can either be substituted by MaxMin1D function or it can easily be replicated in normal code in order to port this solution to CVI base package.

 

Downloads:
Average User Rating
(0 ratings)




There are no comments on this document

More Like This

  • Retrieving data ...