Microsoft Office Tutorials and References
In Depth Information
ADJUST XY CHART SCALING FOR CORRECT ASPECT RATIO
Set Ser = Cht.SeriesCollection(i)
XVals = Ser.XValues
YVals = Ser.Values
If i = 1 Then
MinX = WorksheetFunction.Min(XVals)
MaxX = WorksheetFunction.Max(XVals)
MinY = WorksheetFunction.Min(YVals)
MaxY = WorksheetFunction.Max(YVals)
Else
MinX = WorksheetFunction.Min(MinX, XVals)
MaxX = WorksheetFunction.Max(MaxX, XVals)
MinY = WorksheetFunction.Min(MinY, YVals)
MaxY = WorksheetFunction.Max(MaxY, YVals)
End If
Next
‘Maximize the plot area and get its dimensions
With .PlotArea
.Top = 0
.Left = 0
.Width = Cht.ChartArea.Width
.Height = Cht.ChartArea.Height
PWd = .Width
PHt = .Height
PWd1 = .InsideWidth
PHt1 = .InsideHeight
End With
Set AxX = .Axes(xlCategory)
Set AxY = .Axes(xlValue)
‘Range of X and Y Values from series data
XDiff = MaxX - MinX
YDiff = MaxY - MinY
‘Set a buffer space of 10% of XDiff and YDiff so there is
‘a margin between series boundary and plot area
Buffer = 0.1
‘Adjust values of Max/Min X/Y for buffer
 
Search JabSto ::




Custom Search