<script language=vbs>
Sub Window_OnLoad()
Dim rs, categories, values, c
' This example connects to the Northwind sample database
' and charts the Query "Category Sales for 1995". ADO is used to open a
' connection to the database and return the entire recordset. The query
' contains two columns: Category Name and Category Sales.
' The records are then extracted into strings.
categories = ""
values = ""
' Open the connection and execute the query.
ADOConnection1.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\nwind.mdb"
Set rs = ADOConnection1.Execute("SELECT * FROM [Category Sales for 1995]")
' Start at the first record and move through the entire recordset.
' Field 0 is the category name, Field 1 is the sales value.
' Create a tab-delimited string for the names and one for the values.
rs.MoveFirst
Do While Not rs.EOF
categories = categories & rs.Fields(0).Value & Chr(9)
values = values & rs.Fields(1).Value & Chr(9)
rs.MoveNext
Loop
rs.Close
ADOConnection1.Close
' Remove the leftover tab character at the end of the strings.
categories = Left(categories, Len(categories) - 1)
values = Left(values, Len(values) - 1)
' Create a chart with one series (called "Sales").
ChartSpace1.Clear
ChartSpace1.Charts.Add
ChartSpace1.Charts(0).SeriesCollection.Add
ChartSpace1.Charts(0).SeriesCollection(0).Caption = "Sales"
'Set the series categories and values using the strings created from the recordset.
Set c = ChartSpace1.Constants
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values
' Set the chart type and format the axis as U.S. dollars.
ChartSpace1.Charts(0).Type = c.chChartTypeBarClustered
ChartSpace1.Charts(0).Axes(c.chAxisPositionBottom).NumberFormat = "$#,##0"
End Sub
</script>
temp1=0
temp6=0
for i=1 to total_no
if temp1<total(i,1) then temp1=total(i,1)
if temp6>total(i,1) then temp6=total(i,1)
next
'if temp6=1 then
'else'出现值小于0的情况
temp1=int(temp1)
if temp6>=0 then
temp6=int(temp6)
if temp6>10 then
temp2=mid(cstr(temp6),2,1)
if temp2>4 then
temp3=(int(temp6/(10^(len(cstr(temp6))-1)))-1)*10^(len(cstr(temp6))-1)
else
temp3=(int(temp6/(10^(len(cstr(temp6))-1)))-0.5)*10^(len(cstr(temp6))-1)
end if
temp6=temp3
else
temp6=0
end if
' if temp6-10<0 then temp6=0 else temp6=temp6-10
else
temp6=int(0-temp6)
if temp6>10 then
temp2=mid(cstr(temp6),2,1)
if temp2>4 then
temp3=(int(temp6/(10^(len(cstr(temp6))-1)))+1)*10^(len(cstr(temp6))-1)
else
temp3=(int(temp6/(10^(len(cstr(temp6))-1)))+0.5)*10^(len(cstr(temp6))-1)
end if
temp6=0-temp3
else
temp6=-10
end if
end if
if temp1>9 then
temp2=mid(cstr(temp1),2,1)
if temp2>4 then
temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+1)*10^(len(cstr(temp1))-1)
else
temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+0.5)*10^(len(cstr(temp1))-1)
end if
else
if temp1>4 then temp3=10 else temp3=5
end if
temp4=temp3
response.write "<v:rect id='_x0000_s1027' alt='' style='position:absolute;left:"&table_x+left_width&"px;top:"&table_y&"px;width:"&all_width&"px;height:"&all_height&"px;z-index:-1' fillcolor='#9cf' stroked='f'><v:fill rotate='t' angle='-45' focus='100%' type='gradient'/></v:rect>"
select case table_type
case "A"
for i=0 to all_height step all_height/5
if i<>all_height then response.write "<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+left_width+length&"px,"&table_y+all_height-length-i&"px' to='"&table_x+all_width+left_width&"px,"&table_y+all_height-length-i&"px' strokecolor='"&line_color&"'/>"
if i<>all_height then response.write "<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+left_width&"px,"&table_y+all_height-length-i&"px' to='"&table_x+left_width+length&"px,"&table_y+all_height-i&"px' strokecolor='"&line_color&"'/>"
response.write "<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+(left_width-15)&"px,"&table_y+i&"px' to='"&table_x+left_width&"px,"&table_y+i&"px'/>"
response.write ""
response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x&"px;top:"&table_y+i&"px;width:"&left_width&"px;height:18px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>"&temp4&"</td></tr></table></v:textbox></v:shape>"
temp4=temp4-(temp3-temp6)/5
next