十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这个有现成的代码,把代码做一个简要的说明,具体实现效果,是在TE的地图画一个饼状图。
创新互联公司是一家专业的成都网站建设公司,我们专注做网站、成都网站设计、网络营销、企业网站建设,买友情链接,广告投放为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。function createpie() {
//设置简单参数,包括半径等参数
var sum = 0;
var radius = 100;
var angle = 0;
var i;
//根据饼状图的分块,设置不同的颜色
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;
//根据每块的比例,设置旋转的角度,在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);
//根据点创建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;
}
}
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。