狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識(shí)交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

用ASP制做餅圖、柱狀圖等

admin
2010年7月3日 14:23 本文熱度 5995
[p]  我們工作中經(jīng)常需要將數(shù)據(jù)轉(zhuǎn)化成柱狀圖,餅圖等,以方便直觀的分析數(shù)據(jù), 這里給大家介紹一個(gè)asp中制作餅圖、柱狀圖的組件:csdrawgraph,csdgt.zip,因?yàn)槭墙M件,所以我們?cè)谑褂弥靶枰胷egsvr32.exe 注冊(cè)一下,csdrawgraph,可以在asp中創(chuàng)建餅圖,柱狀圖以及線圖,其支持的格式有g(shù)if, png, jpg and bmp.[/p] [p]  看看如下的柱狀圖,餅圖如何生成的例子:[/p] [p][align=center][img]http://ninedns.com/images/tech/images/a4215_img200748_1.jpg[/img][/align][/p] [p][br]chartdemo.asp[/p] <%@ language=vbscript %>[br][br][br]csdrawgraph demonstration[br][br][br]

this simple demonstration shows two graphs using the same data. the first is [br]a bar chart:

[br]

[br]

[br]

the second is a pie chart. the background colour is set to light [br]grey to show the overall size of the image.

[br]

[br]

[br][br] [p]chartimages.asp[/p] [p]<%@ language=vbscript %>[/p] [p]<%[br]response.expires = 0[br]response.buffer = true[br]response.clear [br]response.contenttype = "image/gif"[/p] [p]set chart = server.createobject("csdrawgraphtrial.draw")[/p] [p][br]chart.adddata "no> 1", 17, "ff0000"[br]chart.adddata "no> 2", 28, "00ff00"[br]chart.adddata "no> 3", 5, "0000ff"[/p] [p]if request.querystring("type") = "pie" then[br] chart.title = "sample pie chart"[br] chart.bgcolor = "eeeeee"[br] chart.labelbgcolor = "eeeeee"[br] chart.titlebgcolor = "eeeeee"[br] response.binarywrite chart.gifpie[br]else[br] chart.title = "sample bar chart"[br] response.binarywrite chart.gifbar[br]end if[/p] [p]response.end[br]%>[/p][br]程序很簡(jiǎn)單,再些不詳細(xì)說(shuō)明,下面看一個(gè)將[url=http://ninedns.com/webhosting/mssql.asp]數(shù)據(jù)庫(kù)[/url]中的數(shù)據(jù)轉(zhuǎn)換到圖表的例子: [p][/p] [p]lines.asp:[/p] [p][br][br]line graph showing all the results[/p] [p][/p] [p][br][br][br]
[br]

links to the other result pages:

[br]

bar chart showing all results for any one day.

[br]

bar charts showing results for each colour separately.

[br][br][/p] [p]gif_lines.asp:[/p] [p]<%@ language=vbscript %>[br]<%[br]'利用[url=http://ninedns.com/webhosting/mssql.asp]數(shù)據(jù)庫(kù)[/url]中的數(shù)據(jù)生成線圖。[br]'根據(jù)4個(gè)不同的值分別生成4條線。[br]'在x軸上顯示星期的名稱。[/p] [p]response.expires = 0[br]response.buffer = true[br]response.clear[/p] [p] '利用下面的語(yǔ)句創(chuàng)建chart對(duì)象,版本不同會(huì)有所差異。[br]'set chart = server.createobject("csdrawgraph.draw")[br]set chart = server.createobject("csdrawgraphtrial.draw")[/p] [p]connectionstring = "provider=microsoft.jet.oledb.4.0;data source=" & _ [br] server.mappath("data.mdb")[br]set dbconn = server.createobject("adodb.connection")[br]dbconn.open connectionstring[br]set rs = server.createobject("adodb.recordset")[br]sql = "select * from table1 order by day"[br]rs.open sql, dbconn[/p] [p] while not rs.eof[br] chart.addpoint cint(rs("day")), cint(rs("red")), "ff0000", "red"[br] chart.addpoint cint(rs("day")), cint(rs("blue")), "0000ff", "blue"[br] chart.addpoint cint(rs("day")), cint(rs("green")), "00ff00", "green"[br] chart.addpoint cint(rs("day")), cint(rs("yellow")), "ffff00", "yellow"[br] chart.addxvalue cint(rs("day")), rs("dayname")[br] rs.movenext[br] wend[/p] [p]'關(guān)閉[url=http://ninedns.com/webhosting/mssql.asp]數(shù)據(jù)庫(kù)[/url]連接[br]rs.close[br]dbconn.close[/p] [p]'下面設(shè)置組件屬性[br]'x軸坐標(biāo)從1開始而不是0。(xoffset = 1)[br][br]chart.title = "all the combined results"[br]chart.titlex = 100[br]chart.yaxistext = "total for each day"[br]chart.originy = 220[br]chart.xoffset = 1[br]chart.xtop = 7[br]chart.xgrad = 1[br]chart.usexaxislabels = true[br]chart.linewidth = 2[br]chart.pointsize = 3[br]chart.pointstyle = 1[/p] [p]'最后圖片以gif格式發(fā)送到瀏覽器[br]response.contenttype = "image/gif"[br]response.binarywrite chart.gifline[br]response.end[br]%>[/p] [p]結(jié)果如圖所示:[/p] [p][align=center][img]http://ninedns.com/images/tech/images/a4215_img200748_2.gif[/img][/align][/p] [p]csdrawgraph的下載地址:http://chestysoft.com/download/csdgt.zip[/p]

該文章在 2010/7/3 14:23:21 編輯過(guò)
相關(guān)文章
正在查詢...
點(diǎn)晴ERP是一款針對(duì)中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國(guó)內(nèi)大量中小企業(yè)的青睞。
點(diǎn)晴PMS碼頭管理系統(tǒng)主要針對(duì)港口碼頭集裝箱與散貨日常運(yùn)作、調(diào)度、堆場(chǎng)、車隊(duì)、財(cái)務(wù)費(fèi)用、相關(guān)報(bào)表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點(diǎn),圍繞調(diào)度、堆場(chǎng)作業(yè)而開發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點(diǎn)晴WMS倉(cāng)儲(chǔ)管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購(gòu)管理,倉(cāng)儲(chǔ)管理,倉(cāng)庫(kù)管理,保質(zhì)期管理,貨位管理,庫(kù)位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號(hào)管理軟件。
點(diǎn)晴免費(fèi)OA是一款軟件和通用服務(wù)都免費(fèi),不限功能、不限時(shí)間、不限用戶的免費(fèi)OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved