Thanks for the new code - I'm such a newbie that I keep doing things the hard way.
Here's the code:
Private Sub cmdDrawGraph_Click()
Dim TotalNumberOfGraphs As Integer 'this is the number of graphs available
Dim arr(1 To 126, 1 To 7) ' 125 rows, 7 lines - 1 flow, 3-2pair windows
Dim PlusData As Integer 'test data - move data positive
Dim MinusData As Integer
PlusData = 1
MinusData = 66
Dim DataPoints(1 To 126, 1 To 1) 'total number of data points
'this is the up plus data
For PlusPoints = 1 To 65 '1st half of the datapoints going up
DataPoints(PlusData, 1) = PlusData
PlusData = PlusData + 1
Next PlusPoints
'this is the down minus data
For MinusPoints = 66 To 124 '2nd half of the datapoints going down
DataPoints(MinusData, 1) = MinusData
MinusData = MinusData - 1
Debug.Print MinusData
Debug.Print DataPoints(MinusData, 1)
Next MinusPoints
Dim m As Variant 'draws the window lines
For m = 1 To 60
arr(m, 2) = 100.5
arr(m, 3) = 300.2
Next m
For n = 40 To 90
arr(n, 4) = 600.3
arr(n, 5) = 700.9
Next n
For q = 70 To 125
arr(q, 6) = 100.6
arr(q, 7) = 200.6
Next q 'draws the window lines
With MSChart1
.ChartType = VtChChartType2dLine
.ShowLegend = True
.Plot.Axis(VtChAxisIdX).Labels(1).VtFont.Name = ariel
.Plot.Axis(VtChAxisIdX).Labels(1).VtFont.Size = 12
.Plot.Axis(VtChAxisIdX).Labels(1).VtFont.Style = Bold
.Plot.Axis(VtChAxisIdX).Labels(1).VtFont.VtColor.Set 204, 204, 204
.TitleText = "IDI BP5 PUMP FLOW GRAPH"
.ChartData = DataPoints
With .DataGrid
.SetSize 1, 7, 126, 7 '(rowLabelCount, columnLabelCount, dataRowCount, columnLabelCount)
Dim intIndex As Integer '*******************
' Dim strAbbrev(1 To 16) As String 'Names the Rows
' strAbbrev(1) = "0 ms"
'strAbbrev(2) = "3 ms"
'strAbbrev(3) = "5 ms"
'strAbbrev(4) = "7 ms"
'strAbbrev(5) = "9 ms"
' strAbbrev(6) = "10 ms"
' strAbbrev(7) = "13 ms"
' strAbbrev(8) = "15 ms"
' strAbbrev(9) = "16 ms"
'strAbbrev(10) = "17 ms"
'strAbbrev(11) = "19 ms"
' strAbbrev(12) = "23 ms"
' strAbbrev(13) = "26 ms"
' strAbbrev(14) = "29 ms"
'strAbbrev(15) = "33 ms"
'strAbbrev(16) = "36 ms"
MSChart1.RowCount = 126
'For intIndex = 1 To 16
' MSChart1.Row = intIndex
'MSChart1.RowLabel = strAbbrev(intIndex) 'Names the Rows
' Next intIndex '********************
End With
With .Plot
With .Axis(VtChAxisIdY).ValueScale
.Auto = False
.Minimum = 0
.Maximum = 1000
End With
With .Axis(VtChAxisIdX).AxisGrid
.MajorPen.VtColor.Set 204, 204, 204
.MajorPen.Width = 2
.MinorPen.VtColor.Set 204, 204, 204
.MinorPen.Width = 2
End With
With .Axis(VtChAxisIdY).AxisGrid
.MajorPen.VtColor.Set 204, 204, 204
.MajorPen.Width = 2
.MinorPen.VtColor.Set 204, 204, 204
.MinorPen.Width = 2
End With
With .SeriesCollection
.Item(1).LegendText = "Flow Data"
.Item(2).LegendText = "#1 Low Limit"
.Item(3).LegendText = "#1 High Limit"
.Item(4).LegendText = "#2 Low Limit"
.Item(5).LegendText = "#2 High Limit"
.Item(6).LegendText = "#3 Low Limit"
.Item(7).LegendText = "#3 HighLimit"
.Item(2).Pen.Style = VtPenStyleDitted
.Item(4).Pen.Style = VtPenStyleDitted
.Item(5).Pen.Style = VtPenStyleDashed
.Item(6).Pen.Style = VtPenStyleDitted
.Item(7).Pen.Style = VtPenStyleDashed
'With .Item(1).DataPoints(-1) 'controls text for flow line - grid too small - can't see the text
' .DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
' .DataPointLabel.VtFont.VtColor.Set 0, 0, 0 '# black text
' .Brush.FillColor.Set 255, 0, 0 '# red line
'End With
With .Item(2).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 0, 102, 255 '# blue
.Brush.FillColor.Set 0, 102, 255
End With
With .Item(3).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 0, 102, 255 '# blue
.Brush.FillColor.Set 0, 102, 255
End With
With .Item(4).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 0, 204, 0 '# green
.Brush.FillColor.Set 0, 204, 0
End With
With .Item(5).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 204, 204, 204 '# green
.Brush.FillColor.Set 0, 204, 0
End With
With .Item(6).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 205, 153, 0 '# brown
.Brush.FillColor.Set 205, 153, 0
End With
With .Item(7).DataPoints(-1)
.DataPointLabel.VtFont.VtColor.Set 205, 153, 0 '# brown
.Brush.FillColor.Set 205, 153, 0
End With
End With '#seriescoll
End With '# plot
End With '#chart
End Sub
Thanks,
Gary