Mapping Graph Coordinates to Plot Image Coordinates

When you use the Plot Images properties, LabVIEW draws the image beginning at the origin of the graph plot area. If you want to use the Plot Images properties to draw an image that uses the graph data points as references rather than the plot area origin (0,0), you can use the Map XY To Coordinates method to map the graph coordinates of the data points to coordinates of the front panel. The Map XY To Coordinates method returns coordinates relative to the origin of the front panel. However, to draw the image correctly, you must make the coordinates relative to the origin of the plot image area located at the top, leftmost corner of the graph plot area. To account for the difference, you must subtract the offset of the plot area of the graph from the origin of the front panel from the coordinates that Map XY To Coordinates returns.

Complete the following steps to programmatically map graph coordinates to the coordinates of the owning pane.

Note  Using splitter bars creates multiple panes. You then account for the offset of the plot area of the graph from the origin of the owning pane.
  1. Right-click the graph and select Create»Invoke Node»Map XY To Coordinates from the shortcut menu to create a Map XY To Coordinates Invoke Node.
  2. Right-click the XY input of the Map XY to Coordinates method and select Create»Constant from the shortcut menu. Wire the graph coordinates of the data points to the XY input of the Map XY To Coordinates method.
  3. Right-click the graph and select Create»Property Node»Plot Area Bounds from the shortcut menu to create a Plot Area Bounds Property Node.
  4. Add the Unbundle By Name function to the block diagram.

    Add Find
  5. Wire the Plot Bounds output of the Plot Area Bounds Property Node to the input cluster input of the Unbundle By Name function.
  6. Resize the Unbundle By Name function so that both the left and top elements appear.
  7. Add the Bundle function to the block diagram.

     Add  Find
  8. Wire the left and top elements of the Unbundle By Name function to the element inputs of the Bundle function.
  9. Add the Subtract function to the block diagram.

     Add  Find
  10. Wire the Coords output of the Map XY To Coordinates Invoke Node to the x input of the Subtract function.
  11. Wire the output cluster output of the Bundle function to the y input of the Subtract function.
  12. Right-click the x–y output of the Subtract function and select Create»Indicator from the shortcut menu.