Microsoft Office Tutorials and References
In Depth Information
ADJUST XY CHART SCALING FOR CORRECT ASPECT RATIO
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
If the horizontal scaling is greater than the vertical scaling, the x axis needs
to be set to a larger scale range (XDiff1) , which is calculated from the
horizontal scaling of the inside width of the plot area. XDiff1 is applied
symmetrically to the x axis scaling (i.e., the minimum scale for the x axis is
reduced by XDiff1/2) , and the maximum scale is incremented by the same
amount. The same is done with the y axis if the vertical scaling is greater than
the horizontal scaling.
Summary: The code in this solution programmatically adjusts a scatter chart
containing series of similar orders of magnitude to display correctly proportioned
series.
 
Search JabSto ::




Custom Search