force directed graph - 如何对节点之间的连接求和

时间:2016-12-15 15:46:09

标签: javascript d3.js

我试图找到一种方法来对节点之间的连接(音量)求和。我有一个数组:

var links = 
[
{"source":"a0","target":"a0","s_portfolio":"a","t_portfolio":"a","SOURCE_TYPE":"APP","DES_TYPE":"APP","File_Desc":"","DataName":""},
{"source":"a1","target":"a2","s_portfolio":"a","t_portfolio":"c","SOURCE_TYPE":"APP","DES_TYPE":"APP","File_Desc":"Date","DataName":"Dates.01012016"},
{"source":"a1","target":"a2","s_portfolio":"a","t_portfolio":"c","SOURCE_TYPE":"APP","DES_TYPE":"APP","File_Desc":"Address","DataName":"Address.01012016"},
{"source":"a1","target":"a0","s_portfolio":"b","t_portfolio":"a","SOURCE_TYPE":"APP","DES_TYPE":"APP","File_Desc":"Customer Name","DataName":"Customer Name.01012016"},
{"source":"a2","target":"a3","s_portfolio":"c","t_portfolio":"d","SOURCE_TYPE":"APP","DES_TYPE":"DB","File_Desc":"Books","DataName":"Books.01012016"},
{"source":"a4","target":"a3","s_portfolio":"e","t_portfolio":"d","SOURCE_TYPE":"APP","DES_TYPE":"DB","File_Desc":"Magazines","DataName":"Magazines.01012016"},
{"source":"a4","target":"a3","s_portfolio":"e","t_portfolio":"d","SOURCE_TYPE":"APP","DES_TYPE":"DB","File_Desc":"Employees","DataName":"Employees.01012016"},
{"source":"a4","target":"a3","s_portfolio":"e","t_portfolio":"d","SOURCE_TYPE":"APP","DES_TYPE":"DB","File_Desc":"Zip","DataName":"Zip.01012016"},
{"source":"a3","target":"a4","s_portfolio":"d","t_portfolio":"e","SOURCE_TYPE":"DB","DES_TYPE":"APP","File_Desc":"PQT","DataName":"PQT.01012016"},
{"source":"a1","target":"a2","s_portfolio":"a","t_portfolio":"c","SOURCE_TYPE":"APP","DES_TYPE":"APP","File_Desc":"YTD","DataName":"YTD.01012016"}
];
  1. s_portfolio和t_portfolio是节点所属的组。
  2. SOURCE_TYPE和DES_TYPE是节点的种类 - 数据库或应用程序
  3. File_Desc是一种正在发送的文件
  4. DataName是文件的名称
  5. 小提琴在这里:https://jsfiddle.net/Alexey_D3/xhx3L8jn/11/

0 个答案:

没有答案