Overview
This example shows how to manually add multiple Y-axes to a WaveformGraph .NET component and how to programmatically assign a plot in a WaveformGraph to one of the added axes.
Description
This example is a modified version of an example shipped with Measurement Studio that is available at the following location: Start » All Programs » National Instruments » Measurement Studio 2010 » .NET Examples. Once in the Measurement Studio Examples directory navigate to the following location: <Measurement Studio Examples>\UI\WindowsForms\Graph\Plotting
Requirements
Steps to Implement or Execute Code
/**
* The following code determines how many plots should be assigned to the axes available. If there are more plots than axes the remainder
* of the plots are left on the default axis.
* After finding the number of Axes available, the plots associated with the WaveformGraph are iterated through and the plots Y-Axis is modified
* to use one of the other Axes available.
**/
int plotIndexIter;
for (plotIndexIter = 0; plotIndexIter < Math.Min(sampleWaveformGraph.Plots.Count, sampleWaveformGraph.YAxes.Count); plotIndexIter++)
sampleWaveformGraph.Plots[plotIndexIter].YAxis = sampleWaveformGraph.YAxes[plotIndexIter];
**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.
What about describing how to do this by code?