Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21116

MSChart grid lines too close

$
0
0
Hello all and thanks ahead of time for any input , it's appreciated
I have a MSChart that is an xy 2d plot for info from a machine operation. It has work for several years but I've upgraded the pc doing the control and data collection. As a result of the upgrade much more data is collected. When I display the data in the mschart the vertical grid is so close together the background is black. Before I was getting 20 or so data points , now I'm getting 400 +.
The data points are displayed between the grid lines as below-
Name:  chart1.JPG
Views: 46
Size:  68.8 KB

After the upgrade
Name:  chartb.JPG
Views: 46
Size:  99.9 KB

Here's the code to input data to the chart:

Private Sub List1_Click()
Dim Selectedstring
Form6.Label4.Visible = False
Form6.Label1.Visible = False
Selectedstring = Form6.File1.Path & "\" & Form6.List1.Text ' & "\" & Form6.File1.filename
Passfileptr = Form6.List1.ListIndex
Passstring = Selectedstring
Dim Tempstring1, Tempstring2 As String
Dim Dataptrx(2, 6)
Dim Delimiter
Dim I, J, K As Integer
Dim y()
Dim Ptr1, Ptr2, Ptr3
Close

Erase y()
Ptr3 = 1
' Loop until end of file.
Ptr1 = InStr(1, Selectedstring, "__")
On Error GoTo Badfilename
Tempstring = Left(Selectedstring, Ptr1 - 1)
Do While Ptr3 <> 0
Ptr2 = Ptr3
Ptr3 = InStr((Ptr3 + 1), Tempstring, "\")
Loop
Part = Right(Tempstring, Len(Tempstring) - Ptr2)
junk = 10
Open (Selectedstring) For Input As #1
Input #1, Delimiter, Partdate
Input #1, Delimeter, Parttime
Input #1, Datastart
Input #1, Datastart
For I = 1 To 2
For J = 0 To 5
' Input #1, Dataptrx(I, J)
Input #1, Delimiter, Dataptr(I, J)
Debug.Print Str(Dataptr(I, J)), Str(I), Str(J)
If EOF(1) Then Exit For
Next J
Next I
For I = 1 To 2
For J = 1 To 1000
If EOF(1) Then Exit For
Input #1, Delimiter, DataShotpos(I, J)
If EOF(1) Then Exit For
Input #1, Delimiter, DataShearpos(I, J)
If EOF(1) Then Exit For
Input #1, Delimiter, DataClamppos(I, J)
If EOF(1) Then Exit For
Input #1, Delimiter, DataNitropress(I, J)
If EOF(1) Then Exit For
Input #1, Delimiter, DataClamppress(I, J)
If EOF(1) Then Exit For
Input #1, Delimiter, DataShotpres(I, J)
Next J
Next I
Close
With Form5.MSChart1
ReDim y(1 To 6, Dataptr(1, 0)) 'number of scans during shot
y(1, 0) = "x1"
y(2, 0) = "x2"
y(3, 0) = "x3"
y(4, 0) = "x4"
y(5, 0) = "x5"
y(6, 0) = "x6"
For I = 1 To (Dataptr(1, 0))
y(1, I) = DataShotpres(1, I)
y(2, I) = DataNitropress(1, I)
y(3, I) = DataClamppress(1, I)
y(4, I) = DataClamppos(1, I)
y(5, I) = DataShotpos(1, I)
y(6, I) = DataShearpos(1, I)
Next I
.Title = Part & " " & Partdate & " " & Parttime
.ChartData = y


ReDim Shotpos(Dataptr(1, 0)), Shottime(Dataptr(1, 0))
ReDim Shearpos(Dataptr(1, 1)), Sheartime(Dataptr(1, 1))
ReDim Clamppos(Dataptr(1, 2)), Clamptime(Dataptr(1, 2))
ReDim Nitropress(Dataptr(1, 3)), Nitropresstime(Dataptr(1, 3))
ReDim Clamppress(Dataptr(1, 4)), Clamppresstime(Dataptr(1, 4))
ReDim Shotpres(Dataptr(1, 5)), Shotpresstime(Dataptr(1, 5))
For J = 0 To 5
For I = 1 To (Dataptr(1, J))
Select Case J
Case 0
Shotpos(I) = DataShotpos(1, I)
Shottime(I) = DataShotpos(2, I)
Case 1
Shearpos(I) = DataShearpos(1, I)
Sheartime(I) = DataShearpos(2, I)
Case 2
Clamppos(I) = DataClamppos(1, I)
Clamptime(I) = DataClamppos(2, I)
Case 3
Nitropress(I) = DataNitropress(1, I)
Nitropresstime(I) = DataNitropress(2, I)
Case 4
Clamppress(I) = DataClamppress(1, I)
Clamppresstime(I) = DataClamppress(2, I)
Case 5
Shotpres(I) = DataShotpres(1, I)
Shotpresstime(I) = DataShotpres(2, I)
End Select
Next I
Next J
Dim myarray As Variant
.ColumnCount = Dataptr(1, 0)
For I = 1 To (Dataptr(1, 0)) ' tried step 25 here
.Column = I
' .ColumnLabel = "ms" ' channel scanned 1st
.ColumnLabel = Str$(Int(DataShotpos(2, I))) & "ms" ' channel scanned 1st
Next I
End With
Form5.Label3.Caption = "Shot " & Str$((Shotpos(1) - Shotpos(Dataptr(1, 0))) / 10) & " in"
Form6.Visible = False
Form5.Visible = True
Exit Sub
junk = 10
Badfilename:
ErrHandler:

MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbMsgBoxHelpButton, "File open error", Err.HelpFile, _
Err.HelpContext
Form6.Label4 = Selectedstring
Form6.Label4.Visible = True
Form6.Label1.Visible = True

End Sub
Attached Images
  

Viewing all articles
Browse latest Browse all 21116


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>