VB Graph Control: Negative Values Plot As Positive

ID Number: Q81451

1.00

WINDOWS

Summary:

Negative values used with certain GraphType and GraphStyle properties

in the Graph custom control will not appear to be negative, but will

instead appear to be positive values. This only occurs in certain

graph types where negative data is either invalid or confusing. This

behavior is by design.

The data itself is not changed when this occurs, it is simply graphed

as positive values. The values can be shown to still be negative by

changing the graph type or style to one where negative data can be

shown.

The GraphType properties that will not show negative data are:

- Stacked-bar types (2-D and 3-D)

- Pie charts (2-D and 3-D)

- Gantt charts

- Log/Lin charts

This information applies to Microsoft Professional Toolkit for

Microsoft Visual Basic programming system version 1.0 for Windows.

More Information:

To demonstrate this behavior, do the following:

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 will appear in the

toolbox.

3. Double-click on the Graph tool to create a Graph custom control

(Graph1).

4. In the Properties Bar, set the following properties for Graph1:

- GraphStyle = 2 (Stacked Bar)

- Height = 2000

- Width = 3000

- NumPoints = 2

- NumSets = 2

Notice Graph1 has two sets of data, with two blue and green bars.

Change the values from the random defaults by changing the values for

the GraphData property on the Properties Bar. Enter 20, 40, 60, and 40

(you must enter these values individually; you cannot enter the values

all at once). Graph1 still contains two blue and two green bars.

GraphData will cycle back to the first point in the first set. Change

its value from 20 to -20. It will appear as though nothing happened;

the graph remains the same. If you change the next value, 40, to -80,

the bar to the right will grow higher. Now change the GraphStyle from

2 - Stacked to 0 - Default. You will now see the blue bars plotted

under the x-axis, reflecting their negative values.

Additional reference words: 1.00