Microsoft Office Tutorials and References
In Depth Information
ADJUST XY CHART SCALING FOR CORRECT ASPECT RATIO
MaxX = MaxX + Buffer * XDiff
MinX = MinX - Buffer * XDiff
MaxY = MaxY + Buffer * YDiff
MinY = MinY - Buffer * YDiff
‘Revised range of X and Y Values with buffer
XDiff = MaxX - MinX
YDiff = MaxY - MinY
‘Rescale Axes for max possible magnifi cation
With AxX
.MaximumScale = MaxX
.MinimumScale = MinX
End With
With AxY
.MaximumScale = MaxY
.MinimumScale = MinY
End With
‘Calculate scaling of plot area per unit X and Y
WdScale = PWd1 / XDiff
HtScale = PHt1 / YDiff
If WdScale > HtScale Then
‘X axis needs to be adjusted
‘keeping Y axis scale unchanged
XDiff1 = (XDiff * WdScale / HtScale - XDiff) / 2
AxX.MinimumScale = MinX - XDiff1
AxX.MaximumScale = MaxX + XDiff1
Else
‘Y axis needs to be adjusted
‘keeping X axis scale unchanged
YDiff1 = (YDiff * HtScale / WdScale - YDiff) / 2
AxY.MinimumScale = MinY - YDiff1
AxY.MaximumScale = MaxY + YDiff1
End If
End With
End Sub
Part
2
 
Search JabSto ::




Custom Search