07-29-2008 09:58 AM
07-31-2008 01:25 AM
07-31-2008 07:36 AM
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
07-31-2008 08:21 AM
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.
07-31-2008 08:38 AM - edited 07-31-2008 08:47 AM
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