Microsoft KB Archive/77739

= Making Multicolored Single Data Bar Charts with CHRTB.BAS =

Article ID: 77739

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft Cinemania 97 Standard Edition
 * Microsoft Visual Basic for MS-DOS

-



This article was previously published under Q77739





SUMMARY
If you create a bar chart with CHRTB.BAS in Microsoft Basic PDS or with CHART.BAS in Visual Basic for MS-DOS and you only have one class of data, all the bars on the graph will be white. However, if you are comparing several classes of data, the bars for each class will be a different color.

CHRTB.BAS and CHART.BAS are part of the Quick Libraries. You can use the LIB and LINK commands to create the Quick Library. For more information explaining how to do this, please see the following article in the Microsoft Knowledge Base:

31156 How to Add Routines to Quick Libraries (.QLB Files)

You can modify the source code of CHRTB.BAS or CHART.BAS to alternate bar chart bar colors when using a single set of data, as shown in the example below.



MORE INFORMATION
If you have just one class of data and you want all the bars of a bar chart created with the Presentation Graphics toolbox library to differ in color, you will need to make the following changes to CHRTB.BAS or CHART.BAS.

On or around line 72 of the SUB clDrawBarData in CHRTB.BAS or CHART.BAS, you will find a line that reads as follows: V = V1(i%, j%) After this line, add the following lines of code: IF GP.NSeries = 1 THEN BarColor% = ( BarColor% MOD 15 ) + 1 ELSE BarColor% = J%  END IF You also need to change the following three lines of code:

On or around line 94, you will find a line that reads:

clRenderBar BarMin, BarLoc, V, BarLoc - BarWid, J% The &quot;J%&quot; in the above line should be changed to &quot;BarColor%&quot;.

You will find this same call to clRenderBar twice more in this sub, and the same change needs to be made. The other two occurrences are on or around lines 107 and 116.

Additional query words: BasicCom 7.00 7.10

Keywords: KB77739

-

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

© Microsoft Corporation. All rights reserved.