這個有現(xiàn)成的代碼,把代碼做一個簡要的說明,具體實現(xiàn)效果,是在TE的地圖畫一個餅狀圖。
創(chuàng)新互聯(lián)公司是一家專業(yè)的成都網(wǎng)站建設公司,我們專注做網(wǎng)站、成都網(wǎng)站設計、網(wǎng)絡營銷、企業(yè)網(wǎng)站建設,買友情鏈接,廣告投放為企業(yè)客戶提供一站式建站解決方案,能帶給客戶新的互聯(lián)網(wǎng)理念。從網(wǎng)站結構的規(guī)劃UI設計到用戶體驗提高,創(chuàng)新互聯(lián)力求做到盡善盡美。function createpie() {
//設置簡單參數(shù),包括半徑等參數(shù)
var sum = 0;
var radius = 100;
var angle = 0;
var i;
//根據(jù)餅狀圖的分塊,設置不同的顏色
var color = [0x0000a0, 0x00ff60, 0x8000a0, 0xa0ff00, 0xff00ff, 0xff2000, 0x20c080, 0x402020, 0x8020a0, 0xff6060, 0xc0ffff, 0xff6060, 0x800040, 0xa00020];
for (i = 1; i < 10; i++) {
sum += i;
}
//選擇中心的位置,也可以自定義進行設置
var cenpoint = SGWorld.Window.CenterPixelToWorld(0);
var cpoint = cenpoint.Position;
var sx = SGWorld.CoordServices.MoveCoord(cpoint.X, cpoint.Y, radius, 0).X;
var sy = SGWorld.CoordServices.MoveCoord(cpoint.X, cpoint.Y, radius, 0).Y;
//根據(jù)每塊的比例,設置旋轉(zhuǎn)的角度,在polygon添加點
for (i = 1; i < 10; i++) {
var color1 = color[i];
var langle = angle + parseFloat(i) / parseFloat(sum) * 360;
var east = radius * Math.cos(2 * Math.PI * langle / 360);
var north = radius * Math.sin(2 * Math.PI * langle / 360);
var movcod = SGWorld.CoordServices.MoveCoord(cpoint.X, cpoint.Y, east, north);
var polygon = "POLYGON((" + cpoint.X.toString() + " " + cpoint.Y.toString() + "," + sx.toString() + " " + sy.toString();
var spl = (langle - angle) / 2;
for (var j = 0; j < spl; j++) {
var sinint = Math.sin((angle + j * 2) * Math.PI / 180) * radius;
var cosint = Math.cos((angle + j * 2) * Math.PI / 180) * radius;
var movcodspl = SGWorld.CoordServices.MoveCoord(cpoint.X, cpoint.Y, cosint, sinint);
polygon += "," + movcodspl.X.toString() + " " + movcodspl.Y.toString();
}
polygon += "," + movcod.X.toString() + " " + movcod.Y.toString() + "," + cpoint.X.toString() + " " + cpoint.Y.toString() + "))";
var igeometry = SGWorld.Creator.GeometryCreator.CreateGeometryFromWKT(polygon);
//根據(jù)點創(chuàng)建polygon
var ipolygon = SGWorld.Creator.CreatePolygon(igeometry, color1, color1, 0, 0, "polygon");
ipolygon.FillStyle.Color.SetAlpha(0.5);
sx = movcod.X;
sy = movcod.Y;
angle = langle;
}
}
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。