var textNode = new JTopo.TextNode('This is a text node.'); // 文本节点
var linkNode = new JTopo.LinkNode('超链接:http://www.jtopo.com'); // 链接节点
linkNode.target = '_blank'; // 新窗口打开链接
linkNode.font = 'italic bold 16px 微软雅黑';
linkNode.visitedColor = '0,0,255'; // 访问过的链接为蓝色
2.添加阴影
linkNode.shadow = true; // 默认值为false
linkNode.shadowOffsetX = 30; // 阴影设置
linkNode.shadowOffsetY = 30;
peopleNode.setBound(500, 210, 64, 64); // 同时设置大小及位置
3.添加圆形节点
var circleNode = new JTopo.CircleNode('node');circleNode.radius = 24; // 半径
circleNode.fillColor = '0, 0, 255'; // 填充颜色
4.自定义绘制节点
var node = new JTopo.Node("自定义");
node.percent = 0.8;
node.beginDegree = 0;
node.width = node.height = 60;
node.setLocation(200, 210);
node.paint = function(g){
g.beginPath();
g.moveTo(0,0);
g.fillStyle = 'rgba(0,255,0,' + this.alpha + ')';
g.arc(0, 0, this.width/2, this.beginDegree, this.beginDegree + 2*Math.PI*this.percent);
g.fill();
g.closePath();
g.save();
g.beginPath();
g.fillStyle = 'rgba(255,255,0,' + this.alpha + ')';
g.moveTo(0,0);
g.arc(0, 0, this.width/2-10, this.beginDegree, this.beginDegree + 2*Math.PI);
g.fill();
g.closePath();
g.restore();
this.paintText(g);
};
scene.add(node);
});