How Can I Programmatically Switch XY Graph Scales?

Updated Aug 22, 2023

Reported In

Software

  • LabVIEW

Issue Details

In my code, I am using an XY Graph to visualize data. Based on the data that is in the graph, I would like to be able to change the scale of the x or y axis on the fly. How can I do this?

Solution

In LabVIEW, it is not possible to dynamically create a scale. Rather, LabVIEW users will need to create all scales  that will be used ahead of time, and switch between the active scale dynamically.

In order to change the active scale, use a Property Node and alter the Active X Scale or Active Y Scale property of the XY graph. This will change what scale is currently active. Then, you can use the X Scale Visible or Y Scale Visible property to change whether the active scale is visible or not. 

For example, if a user wants to switch between scale 0 and scale 1 being visible on the graph, they should first make the 0 scale active, then set X Scale Visible to false. Then, scale 1 can be made active, and X Scale Visible should be set to true.