/*
* 一.d3.js插件自带的JSON数据结构,就两个数组
*/
// 节点
var nodges = [];
//节点组成的边
var edges = [];
/*
* 二. 现在根据实际后台Ajax得到的数据,欲拼接成如下形式(把两数组放进一对象):
*/
var GLOBEL = {
"nodges":[],
"edges":[]
}
/*
* 三. 两个[]里有很对多数据{},定死不变的是:nodes[0]和*nodes[1]~nodes[8]组成7条连线,最终理想输出是:
*/
var GLOBAL = {
"nodes" : [
{
nIndex:0,
name: 为数组labels[0],
type: "R",
len:100,
basic:
{
法定代表:"",
注册资本:"",
成立日期:"",
行业领域:""
}
},{
nIndex:1,
name: 为数组labels[1],
type: "B",
len:24
},{
nIndex:2,
name: 为数组labels[2],
type: "B",
len:24,
basic:
{
法定代表:"",
注册资本:"",
成立日期:"",
行业领域:""
}
},{
nIndex:3,
name: 为数组labels[3],
type: "B",
len:24
},{
nIndex:4,
name: 为数组labels[4],
type: "B",
len:24,
basic:
{
法定代表:"",
注册资本:"",
成立日期:"",
行业领域:""
}
},{
nIndex:5,
name: 为数组labels[5],
type: "B",
len:24,
basic:
{
法定代表:"",
注册资本:"",
成立日期:"",
行业领域:""
}
},{
nIndex:6,
name: 为数组labels[6],
type: "B",
len:24,
basic:
{
法定代表:"",
注册资本:"",
成立日期:"",
行业领域:""
}
},{
nIndex:7,
name: 为数组labels[7],
type: "B",
len:24
}
],
"edges":[
{
source:0,
target:1
},{
source:0,
target:2
},{
source:0,
target:3
},{
source:0,
target:4
},{
source:0,
target:5
},{
source:0,
target:6
},{
source:0,
target:7
},{
source:0,
target:8
}
]
};
/*
定死的初始数据为:var labels = ["xxxx公司", "员工", "法院判决", "股东", "对外投资", "法院公告", "疑似关系", "高管"];
var labels_json = ["corpInfo", "corpEmployees", "corpCourtjudgment", "corpPartners", "invests", "courtAnnouncement", "relationship", "executive"];
问题是:只有是公司类型有才有basic字段,(即labels_json[0],labels_json[2],labels_json[4],labels_json[5],labels_json[6]),难点是:只有判断ajax数据:data.data.corpEmployees,data.data.corpCourtjudgment...有数据时候,按照nIndex顺序追加进nodes[],并且相应生成edges[],卡在这里了。
*/
添加回答
举报
0/150
提交
取消