Example Code

Programmatically Configure the X-Axis Label of a DIAdem Graph Object

Code and Documents

Attachment

Overview

This script rogrammatically modifies the X-Axis label of a graph from DIAdem and demonstrates how to configure the graph objects and properties.

Description

This example shows how to navigate the graph properties in DIAdem. The specific property to modify in this case is the XAxis label text. DIAdem Help for D2AxisXTxt specifies the type of the main object to be 2D-Axis and the type of the subobject to be 2D-XAxis. After creating the object reference to the 2D-Axis, retrieve the 2D-XAxis subobject. If you do not know the object name, use the object type to find the object name. In this case, D2AxisXObj enumeration can be used to iterate through the existing 2D-XAxis objects starting at index 1..AxisNoMax. This example only has 1 2D-XAxis so specify 1 as the index.

For more information on the 2D Axis objects, see the DIAdem Help files:

DIAdem Help Topic: Accessing Objects in DIAdem REPORT

DIAdem Help Topic: Variable: D2AxisXTxt

DIAdem Help Topic: Variable: D2AxisXObj

Steps to Implement or Execute Code

  1. From the SCRIPT tab in DIAdem, open the attached .vbs file.

Requirements

Software

DIAdem (tested in 2012)

Additional Images or Video

The modified graph should look like this:

diademgraphpropertyresult.JPG

Code Snippet

Call GraphObjNew("2D-Axis","my2DAxis")      'Creates a new 2D axis system


Call GraphObjOpen(D2AxisXObj(1))                'Opens reference to X-Axis

    D2AxisXTxt       =     "A Lovely X-Axis"

Call GraphObjClose(D2AxisXObj(1))

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**


Milan

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

Contributors