Why Does My Graph Created Using the CWGraph Control not Autoscale in Microsoft Visual Basic?Primary Software: Measurement Studio>>Visual C++ SupportPrimary Software Version: 6.0 Primary Software Fixed Version: N/A Secondary Software: Measurement Studio>>Visual Basic Support
Problem: I am plotting a waveform using the PlotXY/PlotXvsY methods of the Measurement Studio CWGraph control in Microsoft Visual Basic. The graph always starts at the origin, even though (0,0) is not a data point in my dataset. As a result, the axes do not autoscale. Instead, they include the origin as part of X and Y scales. How can I autoscale the graph correctly?Solution: The root cause of the problem is that (0,0) is in fact getting included in the dataset, caused by an incorrect declaration of the array in Visual Basic. Declaring Dim a(6) creates an array of size 7 elements from 0 to 6. If you define Dim a(6) for an array of 6 elements, like in C, Visual Basic assumes the 7th element to be 0 and that is how the origin gets included in the dataset. Declaring the array correctly will eliminate the unwanted datapoint and will autoscale the graph as desired.Related Links: DeveloperZone Tutorial: Interacting with Measurement Studio Graphs in Visual Basic Attachments:
Report Date: 01/12/2003 Last Updated: 11/13/2008 Document ID: 2TBB6IRT |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
