Microsoft KB Archive/194221

= How To Use the UniformAxis Property to Control Chart Scaling =

Article ID: 194221

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q194221



SUMMARY
When creating an XY Scatter chart using the MSChart control, the resulting chart may appear distorted; that is, very tall and narrow or very short and wide. This occurs on an XY Scatter chart whose axes have ranges that differ by a large amount. For example, an X axis with a range of 0 - 10000 and a Y axis of 0 - 50.



MORE INFORMATION
By default, the scale on the axes of an XY (Scatter) chart is uniform. If the x-values are small in comparison to the y-values, or vice versa, the chart may appear distorted. To allow the scaling of each axis to be independent, change the UniformAxis property of the Plot object to False. The default value of this property is True.

Step-by-Step Example
 Start Visual Basic and create a new Standard EXE project. Form1 is created by default. Click Components from the Project menu and check the "Microsoft Chart Control" component. The MSChart control is made available on the Toolbox. Put an MSChart control on Form1.  Copy and paste the following code to the form's code window: Private Sub Form_Load Dim Graph(1 To 10, 1 To 2) As Single Dim x As Integer For x = 1 To 10 Graph(x, 1) = x  ' value for X-axis Graph(x, 2) = x * 10 ' value for Y-axis Next x        MSChart1.chartType = VtChChartType2dXY  ' set to X Y Scatter chart MSChart1 = Graph ' populate chart's data grid using Graph array ' Leave the following line commented until step 6: 'MSChart1.Plot.UniformAxis = False End Sub

 Press the F5 key to run the project. Note that the chart is not legible (tall and narrow) because both x and y axes are using the same scale and the y-values are larger than the x-values. Stop the project and remove the comment on the last line of code. Press the F5 key to run the project, and note that the chart is legible.</li></ol>

Additional query words: graph appearance height width mschart.ocx kbVBp kbVBp500 kbVBp600 kbCtrl kbdsd kbDSupport

Keywords: kbhowto KB194221

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.