动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   Asp → 阅读文章

 ASP Chart 使用范例

作者来源: 
阅读 数 488 人次 , 2006-4-3 0:03:00 


simple chart example
使用很简单哦,这样就可以了:

用server.createobject建立对象
设置图表属性
调用savechart方法保存到硬盘或者用response.binarywrite chart.image直接发送
下面这段代码是示范如何建立一个柱图的:

ctbar= 1
cnone= 0
cgradient =6

rem **********************************************************************
rem * instantiate the chart component
rem **********************************************************************
set chart = server.createobject ("aspchart.chart")

rem **********************************************************************
rem * add a bar series with 3 points
rem **********************************************************************
chart.addseries (ctbar)
chart.addvalue 200, "regular", vbblue
chart.addvalue 233, "enhanced ", vbred
chart.addvalue 260, "free", vbgreen
chart.barstyle = cgradient

rem **********************************************************************
rem * set the panelcolor, remove the outerbevel
rem **********************************************************************
chart.panelcolor = vbwhite
chart.bevelouter = cnone
chart.chartbgcolor = vbwhite

rem **********************************************************************
rem * set the width and height of the image
rem **********************************************************************
chart.height = 300
chart.width = 500

rem **********************************************************************
rem * set the filename, save the image and write the image tag
rem **********************************************************************
chart.filename = "d:inetpubwwwrootimagessmpchrt1.jpg"
'也不知道用server.mappath,不知道是笨呢还是图效率高。
chart.savechart
response.write "<img src=""/images/smpchrt1.jpg"">"

rem **********************************************************************
rem * destroy the object
rem **********************************************************************
set chart = nothing

multiple series per chart
下面这段代码是示范如何建立多列数据的图表的.

set chart = server.createobject("aspchart.chart")
randomize
chart.addseries 7 'candle series
dblopen = 1000 + rnd(100)
for intcount = 1 to 30
dblbase = round(100*rnd-50)
chart.addcandle now + intcount, dblopen, dblopen+20, dblopen-20, dblopen+dblbase
dblopen = dblopen + dblbase
next

randomize
chart.addseries 5 '这样再调用一次addseries就可以再加一列数据了
dblopen = 1000 + rnd(100)
for intcount =1 to30


dt = now + intcount
dblbase = round(100*rnd-50)
chart.addxy dt, dblopen, cstr(month(dt))+ "/" + _
cstr(day(dt))+"/" +cstr(year (dt) mod 100),vbred
dblopen =dblopen + dblbase
next

再加一段直接输出到浏览器的例子吧:

response.contenttype = "image/jpeg"
dim chart
set chart = server.createobject ("aspchart.chart")
chart.addseries (ctbar)
chart.addvalue 200, "regular", vbblue
chart.addvalue 233, "enhanced ", vbred
chart.addvalue 260, "free", vbgreen
chart.barstyle = cgradient

chart.panelcolor = vbwhite
chart.bevelouter = cnone
chart.chartbgcolor = vbwhite

chart.height = 300
chart.width = 500
response.binarywrite chart.image
set chart = nothing

 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:ASP Ping 简要介绍
· 下一篇:ASP Chart 简要介绍
· 使用 Visual C++创建Crypto加/解密组件
· 正则表达式简介(微软)--7.普通字符
· ASP实现多语言支持
· ASP编程-20个常用范例
· C#和C++最大的不同也是与JAVA最大的相同:单根结构


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077