Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing line weight in plot Rueben6 Charts and Charting in Excel 1 January 26th 09 02:38 PM
Changes to Plot area color My Own IT dept Charts and Charting in Excel 3 August 28th 08 02:28 AM
changing the x axis in a scatter plot Trian Charts and Charting in Excel 1 November 8th 06 09:14 AM
Changing Plot Window Dukebball43 Charts and Charting in Excel 1 February 12th 06 01:55 AM
Changing plot area under macro Don Wiss Excel Programming 0 May 18th 04 01:41 AM


All times are GMT +1. The time now is 03:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"