Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 4 out of 5     Rate this Document

Plotting Discontinuous Lines or Having Plot Gaps on the Measurement Studio CWGraph Control

Primary Software: Measurement Studio>>Visual Basic Support
Primary Software Version: 6.0
Primary Software Fixed Version: 6.0
Secondary Software: LabWindows/CVI Development Systems>>Full Development System

Problem: I want to create plots on the CWGraph control that have discontinuities or gaps. How do I set this up?

Solution: You can plot NaN (Not A Number) values to the Graph that will show up as a discontinuity or gap on the plot.

In Visual Basic 6.0, you need to define the following:

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal pDest As Long, ByVal pSource As Long, ByVal Length As Long)
Private Const NanBase = &H7FF80000

Public Function GenerateNaN() As Double
Call CopyMemory(VarPtr(GenerateNaN) + 4, VarPtr(NanBase), 4)
End Function


To assign a NaN value to a member of the data array, use the GenerateNaN function, as shown in the following example.
data(3) = GenerateNaN ' where data is an array of doubles

If you are using the CWGraph control in LabWindows/CVI, use the NotANumber function in the Programmers Toolbox to create a NaN, as shown in the following example.
data[3] = NotANumber(); //where data is an array of doubles

If you are using Visual C++, you can create a NaN using std::numeric_limits::quiet_NaN(), as shown in the following example.
data[3] = std::numeric_limits::quiet_NaN(); //where data is an array of doubles

If you are using the CWGraph from a .NET language via COM interop, use the NaN member that is a field of the Double structure. The Double structure is part of the .NET Framework.


Related Links:

Attachments:





Report Date: 02/18/2005
Last Updated: 02/23/2005
Document ID: 3IH91P5B

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit