Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Pie chart labels

Have any Excel geniuses written a macro that looks at a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are overlapping
then we fix them by dragging manually. Is there even a
partial solution? I'm not hopeful, but then I'm always
surprised by what you guys come up with.

Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Pie chart labels

Any chance of being rewarded if we can surprise you?
if so how much

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Daniel Bonallack" wrote:

Have any Excel geniuses written a macro that looks at a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are overlapping
then we fix them by dragging manually. Is there even a
partial solution? I'm not hopeful, but then I'm always
surprised by what you guys come up with.

Daniel


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Pie chart labels

I'm definitely all in favor of paying for expertise -
it's only fair. But big firms carry one big
disadvantage - it's certain that if I asked the bank to
pay for it, they would send me to our department of in-
house programmers rather than someone on this forum.

Thanks for responding, but for the moment I'll struggle
through.

Daniel



-----Original Message-----
Any chance of being rewarded if we can surprise you?
if so how much

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Daniel Bonallack" wrote:

Have any Excel geniuses written a macro that looks at

a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are

overlapping
then we fix them by dragging manually. Is there even

a
partial solution? I'm not hopeful, but then I'm

always
surprised by what you guys come up with.

Daniel


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Pie chart labels

Hi Daniel,

Perhaps you could change the position of each label in
turn:

Sub test()
Dim pos1 As Boolean, pos2 As Boolean, pos3 As Boolean
Dim ChObj As Chart

Set ChObj = ActiveChart ' or loop charts
pos1 = False: pos2 = False: pos3 = True
With ChObj.SeriesCollection(1).DataLabels
pos1 = False: pos2 = False: pos3 = True
With chobj.SeriesCollection(1).DataLabels

For i = 1 To .Count
With .Item(i)
If pos3 Then
.Position = xlLabelPositionOutsideEnd
pos1 = True
pos3 = False
ElseIf pos1 Then
.Position = xlLabelPositionInsideEnd
pos2 = True
pos1 = False
Else
.Position = xlLabelPositionCenter
pos2 = False
pos3 = True
End If
End With
Next
End With

End Sub


If something along the lines of the above has
possibilities, you may also want to change the colour of
the font, if it's "inside" the pie. Record a macro and
slot in. Also loop all charts in sheet / wb.

Regards,
Peter

-----Original Message-----
Have any Excel geniuses written a macro that looks at a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are overlapping
then we fix them by dragging manually. Is there even a
partial solution? I'm not hopeful, but then I'm always
surprised by what you guys come up with.

Daniel
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Pie chart labels

Something went amiss with my copy/paste. Obviously
following lines should only appear once:

pos1 = False: pos2 = False: pos3 = True
With chobj.SeriesCollection(1).DataLabels

Peter

-----Original Message-----
Hi Daniel,

Perhaps you could change the position of each label in
turn:

Sub test()
Dim pos1 As Boolean, pos2 As Boolean, pos3 As Boolean
Dim ChObj As Chart

Set ChObj = ActiveChart ' or loop charts
pos1 = False: pos2 = False: pos3 = True
With ChObj.SeriesCollection(1).DataLabels
pos1 = False: pos2 = False: pos3 = True
With chobj.SeriesCollection(1).DataLabels

For i = 1 To .Count
With .Item(i)
If pos3 Then
.Position = xlLabelPositionOutsideEnd
pos1 = True
pos3 = False
ElseIf pos1 Then
.Position = xlLabelPositionInsideEnd
pos2 = True
pos1 = False
Else
.Position = xlLabelPositionCenter
pos2 = False
pos3 = True
End If
End With
Next
End With

End Sub


If something along the lines of the above has
possibilities, you may also want to change the colour of
the font, if it's "inside" the pie. Record a macro and
slot in. Also loop all charts in sheet / wb.

Regards,
Peter

-----Original Message-----
Have any Excel geniuses written a macro that looks at a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are

overlapping
then we fix them by dragging manually. Is there even a
partial solution? I'm not hopeful, but then I'm always
surprised by what you guys come up with.

Daniel
.

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Pie chart labels

Thanks very much Peter - I'll try out your code
-----Original Message-----
Something went amiss with my copy/paste. Obviously
following lines should only appear once:

pos1 = False: pos2 = False: pos3 = True
With chobj.SeriesCollection(1).DataLabels

Peter

-----Original Message-----
Hi Daniel,

Perhaps you could change the position of each label in
turn:

Sub test()
Dim pos1 As Boolean, pos2 As Boolean, pos3 As Boolean
Dim ChObj As Chart

Set ChObj = ActiveChart ' or loop charts
pos1 = False: pos2 = False: pos3 = True
With ChObj.SeriesCollection(1).DataLabels
pos1 = False: pos2 = False: pos3 = True
With chobj.SeriesCollection(1).DataLabels

For i = 1 To .Count
With .Item(i)
If pos3 Then
.Position = xlLabelPositionOutsideEnd
pos1 = True
pos3 = False
ElseIf pos1 Then
.Position = xlLabelPositionInsideEnd
pos2 = True
pos1 = False
Else
.Position = xlLabelPositionCenter
pos2 = False
pos3 = True
End If
End With
Next
End With

End Sub


If something along the lines of the above has
possibilities, you may also want to change the colour

of
the font, if it's "inside" the pie. Record a macro and
slot in. Also loop all charts in sheet / wb.

Regards,
Peter

-----Original Message-----
Have any Excel geniuses written a macro that looks at

a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are

overlapping
then we fix them by dragging manually. Is there even

a
partial solution? I'm not hopeful, but then I'm

always
surprised by what you guys come up with.

Daniel
.

.

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Pie chart labels

Daniel

have you ever used a pie of type 6 in the chartwizard?
ActiveChart.ChartType = xlBarOfPie

imho this layout gives a good 'look and feel' and solves most overlap
problems

.SplitType = xlSplitByPercentValue
.SplitValue = 5
.SecondPlotSize = 50

In case you'd get too many grouped items you'd need to 'post process' only
the labels of the 'barred' smaller items, which is relatively easy as it's
just vertical spreading...



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Daniel Bonallack" wrote:

Have any Excel geniuses written a macro that looks at a
pie chart and spreads the labels to ensure that they
don't overlap.

We have an application that generates thousands of pie
charts - we go through them and if labels are overlapping
then we fix them by dragging manually. Is there even a
partial solution? I'm not hopeful, but then I'm always
surprised by what you guys come up with.

Daniel


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
Macro to change position of chart labels on line chart Shane Henderson[_2_] Charts and Charting in Excel 1 May 27th 11 09:31 AM
Pie Chart and Zero Value Labels Hardip Charts and Charting in Excel 1 August 7th 09 09:21 AM
Labels in a chart Charles Eaves Charts and Charting in Excel 3 November 4th 08 02:18 PM
Chart labels disappear - How do I refresh the chart? jcloydjcloyd Charts and Charting in Excel 0 March 30th 06 07:49 PM
chart labels? X Charter Charts and Charting in Excel 1 May 4th 05 05:57 AM


All times are GMT +1. The time now is 10:59 PM.

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

About Us

"It's about Microsoft Excel"