Sizing Pie Charts

  • Thread starter Thread starter Kreiss
  • Start date Start date
K

Kreiss

Ok, this is driving me crazy.......I have five pie charts
on one page, however I can not the pies to be exact in
size. I've tried to line them up and measure each of the
sizes of the picture box, but have no luck. Does anyone
know of an easy way to get all five of the pie charts the
same size?

Thanks in advance,
Kacy
 
Kacy -

I responded to a similar question yesterday. It was still in my outbox,
so I'll post it again:

Do you have data labels on the outside of the pie? Excel tries to make
room for these, so it shrinks the plot accordingly. You could have the
labels located in the center of each wedge, or you could write a macro
to stretch the plot area. Press Alt-F11 to open the VB Editor, then
press Alt-I then M to insert a module, and paste in this code. Back in
Excel, press Alt-F8 to run either FixActivePie to fix the active chart
or FixAllPies to fix all charts on the worksheet.

' -- Pie Chart Fixing Code -------------
Option Explicit

Const ChtAreaWidth As Integer = 300
Const ChtAreaHeight As Integer = 250

Sub FixActivePie()
If Not ActiveChart Is Nothing And ActiveChart.ChartType = xlPie Then
FixPies ActiveChart
Else
MsgBox "Select a pie chart and try again."
End If
End Sub

Sub FixAllPies()
Dim pie As ChartObject
For Each pie In ActiveSheet.ChartObjects
If pie.Chart.ChartType = xlPie Then
FixPies pie.Chart
End If
Next
End Sub

Sub FixPies(cht As Chart)
Dim i As Integer
With cht
.Parent.Width = ChtAreaWidth
.Parent.Height = ChtAreaHeight
For i = 1 To 4 ' Sometimes you have to repeat it??
.PlotArea.Top = 0
.PlotArea.Width = .ChartArea.Height
.PlotArea.Left = (.ChartArea.Width - .PlotArea.Width) / 2
.Legend.Position = xlLegendPositionRight
Next
End With
End Sub
' -- End of Code --------------------

- Jon
 
Back
Top