ID Number: Q85264
1.00
WINDOWS
Summary:
You can use the Graph custom control (GRAPH.VBX) XPosData property to
give independent X-axis values for graphs. That is, the graph is not
forced to plot on the X-axis, and has the ability to plot fractional
data points between X-axis values. This property can be used with all
graphs types except pie.
This information applies to the Graph custom control supplied with
Microsoft Professional Toolkit for Microsoft Visual Basic programming
system version 1.0 for Windows.
More Information:
By default, graphs use a dependent X-axis scale. This means data
points plotted conform to the whole-number increments shown on the X-
axis. To plot fractional X-axis values, use the XPosData property.
The XPosData values are set for each data point, allowing fractional
X-axis plotted values to appear in the graph. XPosData sets the X
coordinate, and GraphData sets the Y coordinate. The example below
demonstrates this by plotting three different data points on a scatter
graph:
Example
-------
1. Run Visual Basic, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic is already running. Form1 is created by
default.
2. From the File menu, choose Add File. In the Files box, select the
GRAPH.VBX custom control file. The GRAPH tool appears in the
Toolbox.
3. Place a Graph (Graph1) on Form1 by double-clicking the Graph tool
in the Toolbox.
4. In the Properties box, set the following properties for Graph1:
- AutoInc = 0 (Off)
- GraphType = 9 (Scatter)
- NumPoints = 3
- SymbolData = 3 (Solid triangle - up)
5. Add the following code to Form1:
Sub Form_Load ()
Graph1.ThisPoint = 1 'This indicates which datapoint to work on
Graph1.GraphData = 10 'This sets the Y-axis value for this point
Graph1.XPosData = .2 'This sets the X-axis value for this point
Graph1.ThisPoint = 2
Graph1.GraphData = 5
Graph1.XPosData = 1.3
Graph1.ThisPoint = 3
Graph1.GraphData = 3
Graph1.XPosData = 2.4
End Sub
6. Press F5 to run the code.
This example, when run, plots three data points in (X,Y) format. In
this case, XPosData is used to provide non-integer X-axis values. The
three triangles are plotted using the following coordinates:
(.2, 10), (1.3, 5), (2.4, 3)
XPosData works for other graph types too, except pie, for which X-axis
data has no meaning. To try this example with another graph type,
change the GraphType property of Grid1 to "4 - 3D Bar". Notice how the
bars orient against the X-axis when you run the code.
Additional reference words: 1.00