Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Cwgraph starting point

When generating a plot using CWGraph, I have found that even though the array that holds my data starts at index '1', CWGraph wants to continually start my plot at '0'. If I set the minimum value to '1', then I lose the first piece of data. Why is this? How can I start my CWGraph plot at '1' with the first piece of data as I believe it should?
 
Also, I seem to be unable to find a detailed description of the optional parameters for CWGraph.PlotY.
 
Thanks ahead of time for any and all assistance.
0 Kudos
Message 1 of 5
(7,937 Views)
Hello Hrsnblm,
 
What exactly do you mean why "the array that holds my data starts at index '1'", could you please post how you have your array declared and how you are using CWGraph?
 
As for your question regarding the options for CWGraph.PlotY, this can be found in the Measurement Studio Help.
 
I set up a simple example that declared an array and plots it and I did not encounter the same behavior as you, please post a snippet of your code so I can assist further.
With warm regards,

David D.
0 Kudos
Message 2 of 5
(7,928 Views)

   When I first started using CWGraph I noticed that the x-axis started at '0'. I tried to keep my data uniform in how the arrays were utilized, starting them at '1' so that I didn't have to compensate for counts. When I shifted the beginning of the x-axis to '1', it was then I noticed that the display would then drop the first piece of data and start with the second. I tried a couple of different manipulations to get the display to start at '1' on the x-axis and have the graph start at the correct piece of data.

Thank you for your assistance.

*********************************************************************

 '// build array for graph display eliminating empty indexes and keep track of # of empty indexes
    Do While (i <= TotalDays)
        If chData(i) <> "" Then
            tempchData(j) = chData(i)
            i = i + 1
            j = j + 1
        Else
            EmptyCells = EmptyCells + 1
            i = i + 1
        End If

    Loop

    '// Find the lowest value for setting minimum y-axis
   Dim k As Integer
        For k = 1 To (TotalDays - EmptyCells)
            tempValue = CSng(tempchData(k))
            If lwrValue > tempValue Then
                lwrValue = tempValue
            End If

        Next k

    '// Find the highest value for setting maximum y-axis
    Dim l As Integer
        tempValue = 0
        For l = 1 To (TotalDays - EmptyCells)
            tempValue = CSng(tempchData(l))
            If uprValue < tempValue Then
                uprValue = tempValue
            End If

        Next l

        'If pass rate data selected
    If optPass.Value = True Then
        CWRateData.Axes.Item(2).Minimum = Format(lwrValue, "##.0") - 10
        CWRateData.Axes.Item(2).Maximum = 100

    Else
             'If fail rate data selected
            If optFail.Value = True Then
            CWRateData.Axes.Item(2).Minimum = 0
            CWRateData.Axes.Item(2).Maximum = Format(uprValue, "##.0") + 10
            Else
                 'If total processed selected
                If optTotalRun = True Then
                    CWRateData.Plots(1).LineStyle = cwLineStepXY
                    CWRateData.Plots(1).FillToBase = True
                    CWRateData.Plots(1).LineToBase = True
                    CWRateData.Plots(1).PointStyle = cwPointNone
                    CWRateData.Plots(1).LineWidth = 1
                    CWRateData.Plots(1).LineToBaseColor = &H80000005
                    CWRateData.Axes.Item(2).Minimum = 0
                    CWRateData.Axes.Item(2).Maximum = uprValue + 10
                End If

            End If

    End If

    CWRateData.Axes.Item(1).Maximum = (TotalDays - EmptyCells)
    CWRateData.Axes.Item(1).Minimum = 0

    CWRateData.PlotY tempchData

0 Kudos
Message 3 of 5
(7,923 Views)

Hello hrsnblm,

It looks like the xFirst optional parameter of CWGraph.PlotY is what you are looking for, you don't even need to have to mess with the array indexing.

Here's an example:

dim data[3] as int

data[0]=0

data[1]=1

data[2]=2

data[3]=3

CWGraph.PlotY data, 1

 

This will show you the 4 data points with an x min value of 1.

With warm regards,

David D.
0 Kudos
Message 4 of 5
(7,921 Views)

Thank you. This seems to have corrected my problem. I do have a question to hopefully understand why this worked this way. According to the Measurement Studio Help files, setting the x-axis can be done either by one of the two following settings:

CWRateData.Axes.Item(1).Minimum = 1           OR      CWRateData.PlotY tempchData , 1

However, using the first method not only sets the x-axis starting point, but also begins with data that "skips"  my first data-point. The second method only changes the numbering of the x-axis and uses my first data-point. Am I missing something in understanding? I want to make sure that in the future I am properly setting the graph/plot up.

Thank you again for your assistance,

Howard



Message Edited by hrsnblm on 07-31-2008 08:47 AM
0 Kudos
Message 5 of 5
(7,919 Views)