小编Man*_*ack的帖子

D3js强制布局-节点之间的渐变线

这是我的d3强制布局:(请运行代码段)

var width = 600,
    height = 600;

var svg = d3.select('body').append('svg')
    .attr('width', width)
    .attr('height', height);

var color = d3.scale.category20();

var dataNodes = [
    { x:   width/3, y:   height/3 , group: 0, color: 'blue'},
    { x: 2*width/3, y:   height/3, group: 1, color: 'red' },
    { x:   width/2, y: 2*height/3, group: 2, color: 'green'}
];

var dataLinks = [
  { source: 0, target: 1},
  { source: 1, target: 2},
  { source: 2, target: 0}
];

var force = d3.layout.force()
    .charge(-400)
    .linkDistance(height/2) …
Run Code Online (Sandbox Code Playgroud)

javascript svg gradient d3.js

3
推荐指数
1
解决办法
976
查看次数

标签 统计

d3.js ×1

gradient ×1

javascript ×1

svg ×1