Changing plot color
"Cristiano" wrote in message
I have a scatter graph with a few thousand points linked with a smoothed
line.
To change the color, the width and the dash style to the points from Rini
to Rfin-1 I wrote this loop:
For r = Rini To Rfin - 1
With GRA.SeriesCollection(1).Points(r).Format.Line
.ForeColor.RGB = colore
.Weight = W
.DashStyle = dash
End With
Next
but it's terribly slow.
Is there any way to speed it up?
Apply the format for the greatest number of points in one go, something like
Dim sr As Series
Dim pts As Points
Set sr = GRA.SeriesCollection(1)
Set pts = sr.Points
' if Rini To Rfin -1 is most of the points
With sr
.ForeColor.RGB = colore
.Weight = W
.DashStyle = dash
End With
For i = 1 to pts.count
if i < Rini or i Rfin Then
With pts(i)
' apply the other format
End With
End If
Next
Peter T
|