dbColGraph

Display a column of numeric values as a horizontal bar chart in both grid and form mode. Data can be automatically normalized or a Min/Max scale be specified. Note that the group repeat starts at the FieldNameNumber and doesn't include the TableName.

Property Syntax

dbColGraph = "TableName, FieldNameNumber1, Width1, Height1, Icon1, Style1, Min1, Max1, Multiplier1, roundto1, Named_Format1; FieldNameNumber2, Width2, Height2, Icon2, Style2, Min2, Max2, Multiplier2, roundto2, Named_Format2; ...repeat"

dbColGraphMinMaxSQL = "SQL returning first feild as Min and second field as Max" (See example)

Parameters

Parameters

Description

TableName Name of active table.
FieldNameNumber Field name or number containing the numeric values.
Width Width of the Bar.
Height Height of the Bar.
Icon Name of the gif or jpg file used to produce the chart.
Style Style (1-8) of bar chart.
  1. Character (e.g. "x") with no value displayed next to it.
  2. Character (e.g. "x") with value displayed next to it.
  3. Icon (e.g. "dollarsign.gif") with no value displayed next to it.
  4. Icon (e.g. "dollarsign.gif") with value displayed next to it.
  5. Icon Stretched (e.g. " bluebar.gif") with no value displayed next to it.
  6. Icon Stretched (e.g. " bluebar.gif") with value displayed next to it.
  7. Icon Shadowed (e.g. "bluebar.gif") with no value displayed next to it.
  8. Icon Shadowed (e.g. "bluebar.gif") with value displayed next to it.
Min These two value are only necessary when the data source is a user supplied recordset (dbRecordSet property).  They must be set to the minimum and maximum values that the field will contain.  They are necessary for ASP-db to scale the character of icon to the proper size.  With other than the dbRecordSet data sources, ASP-db automatically figures out the minimum and maximum values before displaying the first record, and then scales the bars proportionally.
Mix
Multiplier Multiply the value by the scale factor. Percentage can use this to display 15% instead of the actual value of 0.15.
Roundto Round to after multiplier.
Value = Int(Value * multiplier * 10 ^ (roundto) + Sgn(Value) * 0.5) / 10 ^ (roundto)
Named_Format Format the number at end of graph according to the ASP-db MagicCell Named Formats. (General, Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False or On/Off ). Formatting would only be done with these formats.

 
Example

<%
Set X=Server.CreateObject("ASP.DB")
X.dbQuickProps="1;NWIND;Order details;grid;4"
response.write("<center><h3>Style 1 & 2</h3>")
X.dbColGraph="Order details, UnitPrice,100,,x,1;quantity,100,,,2"
X.ASPDB
response.write("<center><h3>Style 3 & 4</h3>")
X.dbunit=2
X.dbColGraph="Order details, UnitPrice,20,,moneybag.gif,3;quantity,20,,moneybag.gif,4"
X.ASPDB
response.write("<center><h3>Style 5 & 6</h3>")
X.dbunit=3
X.dbColGraph="Order details, UnitPrice,500,18,bluebar.gif,5;quantity,500,12,redbar.gif,6"
X.ASPDB
response.write("<center><h3>Style 7 & 8</h3>")
X.dbUnit=4
X.dbColGraph="Order details,UnitPrice,500,18,bluebar.gif,7;quantity,500,12,redbar.gif,8"
X.ASPDB
%>
Browser Output


Example #2 - Using Multiplier

<%
Set X=Server.CreateObject("ASP.DB")
X.dbQuickProps="1;NWIND;Order details;grid;4"
response.write("<center><h3>Style 1 & 8</h3>")
X.dbColGraph="Order details, UnitPrice,100,,x,1;discount,100,,bluebar.gif,8,,,100"
X.ASPDB
%>

Note that the discount field is displayed after applying the multiplier of 100.

Example #3 - Using User supplied Min/Max SQL

<h3><CENTER>dbColGraph with Auto Scale</CENTER></h3>
<%
Set x=Server.CreateObject("ASP.db")
x.dbUnit = 1
x.dbDSN = "NWIND"
x.dbMode = "GRID"
x.dbImageDir = "/aspdb/images"
sqlcmd = "Select customerID,count(*) as qnty FROM orders where (customerID like 'r%' or customerID like 'a%') group by customerID order by customerID"
x.dbSQL = sqlcmd
x.dbNameMap = "qnty,recCnt,,count(*);"
x.dbColGraph = "orders,qnty,200,12,bluebar.gif,8 ;" ',0,10;" auto scale
'x.dbColGraph = "orders,qnty,200,12,bluebar.gif,8 ,0,10;" 'user scale
x.dbColGraphMinMaxSQL= "Select customerID,count(*) as qnty FROM orders where (customerID like 'r%' or customerID like 'a%') group by customerID order by customerID"
x.ASPdb
%>

Note - Text and Null in Min/Max value will be treated as 0.

 
Notes