I have 5 items I'm trying to track (chart) over 14 days. It's been a struggle attempting to do this with the VB6 Mschart control and is probably a mental block on my end.
I read the data into an array: myarray(14,5). I'm sure the data is filling the array correctly because I print it to a file as the array is being loaded just for debugging.
Data for the first 4 elements, myarray(1,1) - myarray(14,4), appears accurately in the resulting chart but the final data in myarray(14,5) is missing.
I must be forcing a square peg into a round hole because I've had to add a few lines to the MS sample code to get the final rowlabel and columnlabel to appear. They would be blank otherwise.
Below is my code:
Private Sub cmdShow_Click()
Dim ln(5) As String
xln(1) = "Hot"
xln(2) = "Due"
xln(3) = "Mid"
xln(4) = "Mix"
xln(5) = "Skips"
With MSChart1
.chartType = VtChChartType2dLine
.ColumnCount = 5
.RowCount = 14
For Column = 1 To 5
.ColumnLabel = xln(Column - 1) 'Why minus one?
For Row = 1 To 14
.RowLabel = Str(Row - 1) 'Why minus one again?
.Column = Column
.Row = Row
.Data = myarray(Row, Column)
Next Row
.RowLabel = " 14" 'Prints ... 11 12 13 1 otherwise
Next Column
.ColumnLabel = xln(5) 'Prints C5 without this
.ShowLegend = True
.SelectPart VtChPartTypePlot, index1, index2, index3, index4
.EditCopy
.SelectPart VtChPartTypeLegend, index1, index2, index3, index4
.EditPaste
End With
End Sub
Within the properties of my mschart control, I have "Series in rows" unchecked. (The default.)
If someone can help with a solution or tell me where to get a bigger hammer (square peg into round hole) I'd sure appreciate it.
Best regards,
Dave
I read the data into an array: myarray(14,5). I'm sure the data is filling the array correctly because I print it to a file as the array is being loaded just for debugging.
Data for the first 4 elements, myarray(1,1) - myarray(14,4), appears accurately in the resulting chart but the final data in myarray(14,5) is missing.
I must be forcing a square peg into a round hole because I've had to add a few lines to the MS sample code to get the final rowlabel and columnlabel to appear. They would be blank otherwise.
Below is my code:
Private Sub cmdShow_Click()
Dim ln(5) As String
xln(1) = "Hot"
xln(2) = "Due"
xln(3) = "Mid"
xln(4) = "Mix"
xln(5) = "Skips"
With MSChart1
.chartType = VtChChartType2dLine
.ColumnCount = 5
.RowCount = 14
For Column = 1 To 5
.ColumnLabel = xln(Column - 1) 'Why minus one?
For Row = 1 To 14
.RowLabel = Str(Row - 1) 'Why minus one again?
.Column = Column
.Row = Row
.Data = myarray(Row, Column)
Next Row
.RowLabel = " 14" 'Prints ... 11 12 13 1 otherwise
Next Column
.ColumnLabel = xln(5) 'Prints C5 without this
.ShowLegend = True
.SelectPart VtChPartTypePlot, index1, index2, index3, index4
.EditCopy
.SelectPart VtChPartTypeLegend, index1, index2, index3, index4
.EditPaste
End With
End Sub
Within the properties of my mschart control, I have "Series in rows" unchecked. (The default.)
If someone can help with a solution or tell me where to get a bigger hammer (square peg into round hole) I'd sure appreciate it.
Best regards,
Dave