Bar Chart

1. BS Guest

## Bar Chart

hi<BR>How do I create a bar chart i.e how do i show 30% etc. using<BR>VBScript,JavaScript or Java?

2. stephic Guest

## RE: Bar Chart

U need two file first get the value for the bar chart then send to another file,the example code can be:<BR><BR>DIM Value_Array(4)<BR>DIM HistoHeight(4)<BR>Height_of_highest_bar = 150<BR><BR>&#039Collect form info<BR>Value_Array(0) = TRIM(Request.Form("Value0"))<BR>Value_Array(1) = TRIM(Request.Form("Value1"))<BR>Value_Array(2) = TRIM(Request.Form("Value2"))<BR>Value_Array(3) = TRIM(Request.Form("Value3"))<BR>Value_Array(4) = TRIM(Request.Form("Value4"))<BR><BR>&#039If not numeric set value to 0<BR>FOR i=0 TO UBound(Value_Array)<BR>IF NOT IsNumeric(Value_Array(i)) THEN <BR>Value_Array(i)=0<BR>END IF<BR>NEXT<BR><BR>&#039Find the maximum value<BR>Maximum = 0<BR>FOR i=0 TO UBound(Value_Array)<BR> IF CInt(Value_Array(i)) &#062; Maximum THEN<BR> Maximum = CInt(Value_Array(i))<BR> END IF<BR>NEXT<BR><BR>&#039Calculate the height of each bar<BR>FOR i=0 TO UBound(Value_Array)<BR> HistoHeight(i) = FIX((Value_Array(i)/Maximum)*Height_of_highest_bar)<BR> IF HistoHeight(i) &#060; 1 THEN<BR> HistoHeight(i) = 1<BR> END IF<BR>NEXT<BR>%&#062;<BR>&#060;TABLE BORDER=0 CELLPADDING=3&#062;<BR>&#060;TR&#062;<BR>&#060;%FO R i=0 TO UBound(Value_Array)%&#062;<BR>&#060;TD VALIGN=BOTTOM&#062;&#060;IMG SRC="blue.gif" width=25 HEIGHT="&#060;%=HistoHeight(i)%&#062;"&#062;&#060;/TD&#062;<BR> &#060;%NEXT%&#062;<BR> &#060;TR&#062;<BR> &#060;%FOR i=0 TO UBound(Value_Array)%&#062;<BR>&#060;TD&#062;&#060; FONT FACE="Arial,Helvetica" SIZE=1&#062;&#060;CENTER&#062;&#060;%=Value_Array( i)%&#062;&#060;/CENTER&#062;&#060;/FONT&#062;&#060;/TD&#062;<BR> &#060;%NEXT%&#062; <BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•