一個不需要第三方組件,可實現華簡單圖形的類
當前位置:點晴教程→知識管理交流
→『 技術文檔交流 』
[p]通常我們做統計圖的時候需要借助組件來完成例如mschart,aspchart等[br]但是這個類不需要任何組件,而且使用方便[br]clsgraph.asp [br]<%[br]class inteligraph [/p]
[p][br]public copyright, developer, name, version, web[br]public maximum, barwidth, barcolor, orientation[br]private items(), cnt[/p] [p]private sub class_initialize()[br]copyright = "?2001 ticluse teknologi, all rights reserved."[br]developer = "james lind雗"[br]name = "inteligraph"[br]version = "1.0"[br]web = "[url=http://intelidev.com]http://intelidev.com[/url]"[br]cnt = 0[br]end sub[/p] [p]public function add( value )[br]redim preserve items( cnt )[br]items( cnt ) = value[br]data = cnt[br]cnt = cnt + 1[br]add = data[br]end function[/p] [p]public function build()[br]if cnt < 1 then exit function[br]if len( orientation ) = 0 or lcase( orientation ) = "horizontal" then[br]for idx = lbound( items ) to ubound( items )[br]data = data & "
[p]end class[br]%>[br]使用方法[br]這個類一共有四個屬性[br]barwidth(圖片條的尺寸)[br]barcolor*(圖片條顏色)[br]maximum(圖片條最大長度)[br]orientation(方向)[br]有兩個函數[br]add( value )添加圖片條到圖片中[br]build()建立圖片[br]事例:[br][br]<%[br]public const vert = "vertical"[br]public const horz = "horizontal"[/p] [p]dim graph[/p] [p]set graph = new inteligraph[br]graph.barwidth = 10[br]graph.barcolor = "blue"[br]graph.maximum = 100[br]graph.orientation = horz[/p] [p]for idx = 0 to 100 step 25[br]graph.add( idx )[br]next[/p] [p]response.write( graph.build() )[br]%>[/p] 該文章在 2010/7/8 0:34:31 編輯過 |
關鍵字查詢
相關文章
正在查詢... |