![]() |
Changing plot color
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? Thank you Cristiano |
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 |
Changing plot color
On 26/08/2017 13:31, Peter T wrote:
Apply the format for the greatest number of points in one go, something like [...] ' if Rini To Rfin -1 is most of the points Unfortunately, it's not the case. 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 It's not clear to me why you put the 'if' inside the 'for'. Cristiano |
Changing plot color
"Cristiano" wrote in message On 26/08/2017 13:31, Peter T wrote: Apply the format for the greatest number of points in one go, something like [...] ' if Rini To Rfin -1 is most of the points Unfortunately, it's not the case. In that case maybe even working with a direct reference to .Points as I suggested might help a bit With pts(r).Format.Line v With GRA.SeriesCollection(1).Points(r).Format.Line 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 It's not clear to me why you put the 'if' inside the 'for'. The original idea was to apply formats to the entire SerisCollection first, then apply a different format (the original perhaps) to the smaller number of other points. So the 'If' was to exclude and not format points between Rini and Rfin in the loop of all points. If only to visually convey the data do you need to show 1000s of points, would say showing every 5th point show virtually the same. If there might be outliers between every 5th point could also include these. Just a thought. Peter T |
Changing plot color
On 26/08/2017 17:27, Peter T wrote:
"Cristiano" wrote in message On 26/08/2017 13:31, Peter T wrote: Apply the format for the greatest number of points in one go, something like [...] ' if Rini To Rfin -1 is most of the points Unfortunately, it's not the case. In that case maybe even working with a direct reference to .Points as I suggested might help a bit With pts(r).Format.Line v With GRA.SeriesCollection(1).Points(r).Format.Line Yes, it helped a bit, thank you. 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 It's not clear to me why you put the 'if' inside the 'for'. The original idea was to apply formats to the entire SerisCollection first, then apply a different format (the original perhaps) to the smaller number of other points. So the 'If' was to exclude and not format points between Rini and Rfin in the loop of all points. If only to visually convey the data do you need to show 1000s of points, would say showing every 5th point show virtually the same. If there might be outliers between every 5th point could also include these. Just a thought. Step 5 is too much, but step 2 seems good. Thanks a lot Cristiano |
All times are GMT +1. The time now is 01:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com