六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

使用AspImage制作圖形(二)

[摘要]/*豆腐制作,都是精品http://www.asp888.net 豆腐技術站如轉載,請保留完整版權信息*/前面我們講了如何利用AspImage來制作柱圖,柱圖還好辦,起碼有關于長方形的函數,我們可以來借用,但是如果是,餅圖怎么辦?有的朋友不是說了,AspImage上不是有Pie的函數嗎?是呀,它是...
/*
豆腐制作,都是精品
http://www.asp888.net 豆腐技術站
如轉載,請保留完整版權信息
*/

前面我們講了如何利用AspImage來制作柱圖,柱圖還好辦,起碼有關于長方形的函數,我們可以來
借用,但是如果是,餅圖怎么辦?
有的朋友不是說了,AspImage上不是有Pie的函數嗎?是呀,它是有,但是它的那個也太難用了。
豆腐沒有辦法,經過同事的幫助,利用我們高中學習的三角形公式(三角形公式?有沒有搞錯?)
終于做出了這樣的函數,而且使用起來非常的方便。大家請看
Function DrawPie(ArrNum,arrText)
'函數功能:根據指定的 數值和顯示,他們均是 數組
'**********以下是變量定義**************************
dim intTotal '當前
dim i
dim intSettledAngle
dim arrColor(6)
'----------以下是代碼開始--------------------------
'設置顏色
i=0
arrColor(i)=RGB(255,255,255)
i=i+1
arrColor(i)=RGB(255,255,0)
i=i+1
arrColor(i)=RGB(255,0,255)
i=i+1
arrColor(i)=RGB(0,255,255)
i=i+1
arrColor(i)=RGB(255,0,0)
i=i+1
arrColor(i)=RGB(0,255,0)
i=i+1
arrColor(i)=RGB(0,0,255)
i=i+1
'以下開始 對數據進行處理
'首先得到 數量的總數

intTotal=0
for i=0 to UBOUND(ArrNum)
intTotal=intTotal + ArrNum(i)
Next

Set Image = Server.CreateObject("AspImage.Image")

'設定 圖象的 區域大小
Image.MaxX=300
Image.MaxY=300
'生成漸進色
Image.GradientTwoWay rgb(41,137,204),vbWhite ,0,1

'處理角度
intSettledAngle=0
intRectStart=0
for i=0 to ubound(ArrNum)
intAngle=(arrNum(i)/intTotal)*360
'一個一個的畫 扇區,最終合成一個完整的 圓
set Image=DrawSinglePie(Image, 360-intSettledAngle,arrColor(i))

'在圖象的最下方 對圖象內容進行描述
Image.BackgroundColor =arrColor(i)
Image.Rectangle intRectStart+10*(i+1),250,intRectStart+10*(i+1)+10,260
Image.TextOut arrText(i), intRectStart+10*(i+1)+10,245,false

'在圖象的最下方 對圖象內容進行描述
Image.BackgroundColor =arrColor(i)
Image.Rectangle intRectStart+10*(i+1),270,intRectStart+10*(i+1)+10,280
Image.TextOut cstr(intAngle) & "%", intRectStart+10*(i+1)+10, 265,false
intRectStart=intRectStart+50
intSettledAngle=intSettledAngle + intAngle
next
Image.FileName=server.MapPath("http://www.okasp.com/techinfo/test.jpg")
Image.SaveImage
set Image=nothing
Response.Write "<img src=http://www.okasp.com/techinfo/test.jpg>"
End Function

function DrawSinglePie(Image,intAngle,intColor)
'函數功能: 根據指定的 角度和顏色 畫一個矩形
'**************以下是變量定義********************
const pi=3.1415926 '圓周率
dim pii '經過180角轉換后的圓周,弧度
dim x1,x2,x3,x4 '4個X坐標
dim y1,y2,y3,y4 '4個Y坐標
dim intR '圓的半徑,這個半徑不是真正的圓的半徑,但是可以用來固定圓心的位置
'--------------以下是代碼開始--------------------
'**********************************
'*
'*(x1,y1),(x2,y2) 和 圓心必須在 通過(0,0) 的 斜角45 的直線上
'***********************************
pii=pi/180
if intAngle > 360 then
intAngle=intAngle-360
end if
x1=10
y2=10
x2=250
y2=250

intR=(x1+x2)/2
'************************************
'*
'*以下利用 三角形 公式 得到相應 Point 的坐標
'************************************
if intAngle<135 then
'角度不足 135
angle=intAngle*pii
x3=tan(angle-45*pii)*intR+intR '
y3=0
x4=0
y4=0
elseif intAngle=135 then
x3=(intR)*2
y3=intR
x4=0
y4=0
elseif intAngle<315 then
angle=intAngle*pii
intTemp=(intR/tan(angle-135*pii))-intR
x3=250+intTemp
y3=250
x4=0
y4=0
elseif intAngle=315 then
x3=(-intR)*2
y3=intR
x4=0
y4=0
else
angle=intAngle*pii
x3=tan(angle-45*pii)*intR+intR
y3=0
x4=0
y4=0
end if

Image.BackgroundColor =intColor
Image.Pie x1,y1,x2,y2,x3,y3,x4,y4

'Image.TextOut 360-intAngle,(125+x3)/2+20,(125+y3)/2+20,false
'Image.TextOut intRatio ,intPosX,intPosY,false

set DrawSinglePie=Image
end function

最后我們在利用 drawPie 中傳遞要顯示的數據的數組就可以了。


主站蜘蛛池模板: 特黄色片| 桃花视频在线观看免费迅雷 | 中文字幕在线看视频一区二区三区 | 色版网站 | 五月婷婷之综合激情 | 色噜噜在线观看 | 天天干夜夜爽天天操夜夜爽视频 | 欧洲一区在线观看 | 欧美在线视频免费 | 欧美一欧美一区二三区性 | 日本伊人网 | 中文字幕日韩一区二区不卡 | 婷婷色吧| 四虎精品影院4hutv四虎 | 日本在线日本中文字幕日本在线视频播放 | 亚洲va久久久噜噜噜久久狠狠 | 五月天狠狠操 | 欧美偷拍小视频 | 欧美性视频在线 | 日韩生活片 | 青青草激情视频 | 人人爱人人做 | 日本免费一区二区在线观看 | 手机在线看片国产日韩生活片 | 欧美一区二区三区婷婷月色 | 亚州国产 | 五月天婷婷丁香中文在线观看 | 午夜影院在线 | 亚洲成人高清 | 色www亚洲 | 亚洲影院国产 | 伊人影视 | 欧美一区不卡二区不卡三区 | 最新99热 | 在线观看h视频播放高清 | 天天操天天舔天天射 | 性配久久久| 午夜在线一区 | 在线国产网站 | 一级免费看片 | 啪啪免费视频 |