Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSChart Pen Style Problem

Status
Not open for further replies.

norason

Programmer
Jan 28, 2009
139
US
Why doesn't this:
.DataPointLabel.LineStyle = VtPenStyleDashed
produce a dashed line for series 5? It doesn't choke on it - it just ignores it.


Private Sub cmdDrawGraph_Click()
Dim arr(1 To 16, 1 To 6)
arr(1, 1) = Val(LblGraphPoint1.Caption)
arr(2, 1) = Val(LblGraphPoint2.Caption)
arr(3, 1) = Val(LblGraphPoint3.Caption)
arr(4, 1) = Val(LblGraphPoint4.Caption)
arr(5, 1) = Val(LblGraphPoint5.Caption)
arr(6, 1) = Val(LblGraphPoint6.Caption)
arr(7, 1) = Val(LblGraphPoint7.Caption)
arr(8, 1) = Val(LblGraphPoint8.Caption)
arr(9, 1) = Val(LblGraphPoint9.Caption)
arr(10, 1) = Val(LblGraphPoint10.Caption)
arr(11, 1) = Val(LblGraphPoint11.Caption)
arr(12, 1) = Val(LblGraphPoint12.Caption)
arr(13, 1) = Val(LblGraphPoint13.Caption)
arr(14, 1) = Val(LblGraphPoint14.Caption)
arr(15, 1) = Val(LblGraphPoint15.Caption)
arr(16, 1) = Val(LblGraphPoint16.Caption)
Dim m As Integer
For m = 1 To 16
arr(m, 2) = 2
Next m
Dim n As Integer
For n = 1 To 16
arr(n, 3) = 3
Next n
Dim k As Integer
For k = 1 To 16
arr(k, 4) = 5
Next k
Dim p As Integer
For p = 1 To 16
arr(p, 5) = 8
Next p
Dim q As Integer
For q = 1 To 16
arr(q, 6) = 9
Next q
With MSChart1
.ChartType = VtChChartType2dLine
'.Plot.Axis(VtChAxisIdZ).Labels(1).VtFont.Size = 24
.DataGrid.ColumnLabel(1, 1) = "Label Z1"
.ShowLegend = True
With Form1.MSChart1.Plot.Axis(VtChAxisIdY).ValueScale
.Auto = False
.Minimum = 0
.Maximum = 12
End With
With MSChart1.Plot.Axis(VtChAxisIdX).AxisGrid
.MajorPen.VtColor.Set 255, 0, 0
.MajorPen.Width = 4
.MinorPen.VtColor.Set 0, 0, 255
.MinorPen.Width = 2
End With
.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 0, 153, 0
.TitleText = "TEST GRAPH"
.ChartData = arr
With .DataGrid
.SetSize 1, 6, 16, 6 '(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 = 16
For intIndex = 1 To 16
MSChart1.Row = intIndex
MSChart1.RowLabel = strAbbrev(intIndex) 'Names the Rows
Next intIndex '********************
End With
With .Plot
With .SeriesCollection
With .Item(1).DataPoints(-1)
.DataPointLabel.LocationType = VtChLabelLocationTypeBelowPoint
.DataPointLabel.VtFont.VtColor.Set 255, 0, 0 '# red
.Brush.FillColor.Set 255, 0, 0
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
.DataPointLabel.LineStyle = VtPenStyleDashed
End With
With .Item(6).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

 
Yikes - I got it! I must be getting better at this!

Here's the fix:

With .Plot
With .SeriesCollection
.Item(5).Pen.Style = VtPenStyleDashed
.Item(6).Pen.Style = VtPenStyleDashed

I'm still trying to find out if I can have more that 6 series...


Thanks,

Gary

 
Ok, so the answer is yes, I can have more than 6 series - I figured that out also. I think I'll ask for a raise - I'm getting so good at this!



Private Sub cmdDrawGraph_Click()
Dim arr(1 To 16, 1 To 7)
arr(1, 1) = Val(LblGraphPoint1.Caption)
arr(2, 1) = Val(LblGraphPoint2.Caption)
arr(3, 1) = Val(LblGraphPoint3.Caption)
arr(4, 1) = Val(LblGraphPoint4.Caption)
arr(5, 1) = Val(LblGraphPoint5.Caption)
arr(6, 1) = Val(LblGraphPoint6.Caption)
arr(7, 1) = Val(LblGraphPoint7.Caption)
arr(8, 1) = Val(LblGraphPoint8.Caption)
arr(9, 1) = Val(LblGraphPoint9.Caption)
arr(10, 1) = Val(LblGraphPoint10.Caption)
arr(11, 1) = Val(LblGraphPoint11.Caption)
arr(12, 1) = Val(LblGraphPoint12.Caption)
arr(13, 1) = Val(LblGraphPoint13.Caption)
arr(14, 1) = Val(LblGraphPoint14.Caption)
arr(15, 1) = Val(LblGraphPoint15.Caption)
arr(16, 1) = Val(LblGraphPoint16.Caption)
Dim m As Integer
For m = 1 To 16
arr(m, 2) = 2
Next m
Dim n As Integer
For n = 1 To 16
arr(n, 3) = 3
Next n
Dim k As Integer
For k = 1 To 16
arr(k, 4) = 5
Next k
Dim p As Integer
For p = 1 To 16
arr(p, 5) = 8
Next p
Dim q As Integer
For q = 1 To 16
arr(q, 6) = 9
Next q
With MSChart1
.ChartType = VtChChartType2dLine
'.Plot.Axis(VtChAxisIdZ).Labels(1).VtFont.Size = 24
.DataGrid.ColumnLabel(1, 1) = "Label Z1"
.ShowLegend = True
With Form1.MSChart1.Plot.Axis(VtChAxisIdY).ValueScale
.Auto = False
.Minimum = 0
.Maximum = 12
End With
With MSChart1.Plot.Axis(VtChAxisIdX).AxisGrid
.MajorPen.VtColor.Set 255, 0, 0
.MajorPen.Width = 4
.MinorPen.VtColor.Set 0, 0, 255
.MinorPen.Width = 2
End With
.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 0, 153, 0
.TitleText = "TEST GRAPH"
.ChartData = arr
With .DataGrid
.SetSize 1, 7, 16, 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 = 16
For intIndex = 1 To 16
MSChart1.Row = intIndex
MSChart1.RowLabel = strAbbrev(intIndex) 'Names the Rows
Next intIndex '********************
End With
With .Plot
With .SeriesCollection
.Item(5).Pen.Style = VtPenStyleDashed
.Item(6).Pen.Style = VtPenStyleDashed
.Item(7).Pen.Style = VtPenStyleDashed
With .Item(1).DataPoints(-1)
.DataPointLabel.LocationType = VtChLabelLocationTypeBelowPoint
.DataPointLabel.VtFont.VtColor.Set 255, 0, 0 '# red
.Brush.FillColor.Set 255, 0, 0
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top