Excel Chart with equal length axis

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to create a chart that is square?
i.e. the length of the x axis is equal to the length of the y axis
and be centered in landscape?
 
Hi,

I this you are going to need VBA code to do this.
This example uses the smallest length to square the chart to.

'--------------------------------------
Sub Squareplot()
Application.ScreenUpdating = False
With ActiveChart
If .PlotArea.InsideHeight > .PlotArea.InsideWidth Then
Do While .PlotArea.InsideWidth < .PlotArea.InsideHeight
.PlotArea.Height = .PlotArea.Height - 1
Loop
Else
Do While .PlotArea.InsideHeight < .PlotArea.InsideWidth
.PlotArea.Width = .PlotArea.Width - 1
Loop
End If
.PlotArea.Left = (.ChartArea.Width - .PlotArea.Width) / 2
.PlotArea.Top = (.ChartArea.Height - .PlotArea.Height) / 2
End With
Application.ScreenUpdating = True
End Sub
'------------------------------------

Cheers
Andy
 
Back
Top