Example Code

Zoom and Scroll Two Graphs Simultaneously

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

  • Measurement Studio

Code and Documents

Attachment

 

Overview

This program allows you to zoom and scroll two graphs simultaneously.

 

Description

This program displays two scatter graph plots on the user interface, and allows the user to zoom and scroll either graph, while having the other graph zoom and scroll automatically to the same x- and y-axis values.

This is implemented using the AfterDrawPlot event which is generated each time a graph is redrawn.  When one graph changes its plot, the program checks its new x- and y-axis values and updates the other graph accordingly.

NOTE: Scrolling can be done by holding down the Ctrl key and dragging the cursor along the graph.  Zooming can be done by holding down the Shift key and clicking and dragging a selection of the graph to zoom in on.

 

Requirements

  • Visual Studio 2012 (or compatible)
  • Measurement Studio 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Open LinkTwoGraphs.sln.
  2. In Form1.cs look for the "//TODO" comment and change how the data is populated to plot your own data.

 

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

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