配置项如下
//http://ip:8087/api/datacatalog/front/queryDataMap?_=1552964493790
var getData = [{
"text": "数据中心数据地图",
"children": [{
"text": "监管",
"children": [{
"text": "会计记账",
"children": null,
"nodeId": "5c908d099636f427033bce3d",
"jumpable": true,
"childSize": 0
}, {
"text": "客户信息",
"children": [{
"text": "基本信息",
"children": null,
"nodeId": "5c908d9c9636f427033bce42",
"jumpable": true,
"childSize": 0
}, {
"text": "分类信息",
"children": null,
"nodeId": "5c908daa59736178ae30c850",
"jumpable": true,
"childSize": 0
}, {
"text": "关联信息",
"children": null,
"nodeId": "5c908dbd59736178ae30c851",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c908d179636f427033bce3e",
"jumpable": true,
"childSize": 3
}, {
"text": "授信交易对手",
"children": null,
"nodeId": "5c908d21ba515f267ee78ce0",
"jumpable": true,
"childSize": 0
}, {
"text": "卡片信息",
"children": null,
"nodeId": "5c908d2d59736178ae30c84f",
"jumpable": true,
"childSize": 0
}, {
"text": "信贷管理",
"children": null,
"nodeId": "5c908d35ba515f267ee78ce1",
"jumpable": true,
"childSize": 0
}, {
"text": "交易流水",
"children": null,
"nodeId": "5c908d4bba515f267ee78ce2",
"jumpable": true,
"childSize": 0
}, {
"text": "统计全科目",
"children": null,
"nodeId": "5c908d56ba515f267ee78ce4",
"jumpable": true,
"childSize": 0
}, {
"text": "资金业务",
"children": null,
"nodeId": "5c908d5f9636f427033bce41",
"jumpable": true,
"childSize": 0
}, {
"text": "理财业务",
"children": null,
"nodeId": "5c908d68ba515f267ee78ce5",
"jumpable": true,
"childSize": 0
}, {
"text": "公共信息",
"children": null,
"nodeId": "5c6ca43d30eba4075f5fd1ad",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c6bd00281c4a207675d31da",
"jumpable": true,
"childSize": 10
}, {
"text": "测试长名字",
"children": [{
"text": "长标题长标题太突然单人肥嘟嘟风格的费费爱疯",
"children": null,
"nodeId": "5c4e6a327ecfc771acb385f9",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c3c5fab25f66955b02f96aa",
"jumpable": true,
"childSize": 1
}, {
"text": "核能",
"children": [{
"text": "研发",
"children": [{
"text": "项目管理",
"children": null,
"nodeId": "5bf7c883882e6944ead960e4",
"jumpable": true,
"childSize": 0
}, {
"text": "技术服务",
"children": null,
"nodeId": "5bf7c88c882e6944ead960e5",
"jumpable": true,
"childSize": 0
}, {
"text": "高端设备供货",
"children": null,
"nodeId": "5bf7c89d882e6944ead960e6",
"jumpable": true,
"childSize": 0
}, {
"text": "科技研发",
"children": null,
"nodeId": "5bf7c8a6882e6944ead960e7",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5bf7c82e882e6944ead960dd",
"jumpable": true,
"childSize": 4
}, {
"text": "运营",
"children": [{
"text": "生产准备",
"children": null,
"nodeId": "5bf7c976882e6944ead960f1",
"jumpable": true,
"childSize": 0
}, {
"text": "生产管理",
"children": null,
"nodeId": "5bf7c91e882e6944ead960ec",
"jumpable": true,
"childSize": 0
}, {
"text": "培训管理",
"children": null,
"nodeId": "5bf7c927882e6944ead960ed",
"jumpable": true,
"childSize": 0
}, {
"text": "安全管理",
"children": null,
"nodeId": "5bf7c951882e6944ead960ee",
"jumpable": true,
"childSize": 0
}, {
"text": "技术管理",
"children": null,
"nodeId": "5bf7c95b882e6944ead960ef",
"jumpable": true,
"childSize": 0
}, {
"text": "维修管理",
"children": null,
"nodeId": "5bf7c968882e6944ead960f0",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5bf7c841882e6944ead960df",
"jumpable": true,
"childSize": 6
}, {
"text": "建设",
"children": [{
"text": "调试管理",
"children": null,
"nodeId": "5bf7c8eb882e6944ead960e9",
"jumpable": true,
"childSize": 0
}, {
"text": "施工管理",
"children": null,
"nodeId": "5bf7c8f4882e6944ead960ea",
"jumpable": true,
"childSize": 0
}, {
"text": "材料与采购管理",
"children": null,
"nodeId": "5bf7c900882e6944ead960eb",
"jumpable": true,
"childSize": 0
}, {
"text": "其他",
"children": null,
"nodeId": "5bf7c988882e6944ead960f2",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5bf7c848882e6944ead960e0",
"jumpable": true,
"childSize": 4
}, {
"text": "设计",
"children": [{
"text": "设计管理",
"children": null,
"nodeId": "5c41329925f6695f48936eec",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c3c619125f66955b02f96ae",
"jumpable": true,
"childSize": 1
}],
"nodeId": "5bf3b785882e690b957a5213",
"jumpable": true,
"childSize": 4
}, {
"text": "核燃料",
"children": [{
"text": "设备",
"children": null,
"nodeId": "5c41332325f6695f48936eed",
"jumpable": true,
"childSize": 0
}, {
"text": "测试11",
"children": [{
"text": "221",
"children": null,
"nodeId": "5c628fcbf2b8b04c63da3e8a",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c628f84f2b8b04c63da3e89",
"jumpable": true,
"childSize": 1
}],
"nodeId": "5bf3b312882e690b957a520d",
"jumpable": true,
"childSize": 2
}, {
"text": "金融",
"children": [{
"text": "目录3",
"children": null,
"nodeId": "5c3c5f2525f66955b02f96a1",
"jumpable": true,
"childSize": 0
}, {
"text": "测试88的目录1",
"children": null,
"nodeId": "5c403f5f25f6695e24662e09",
"jumpable": true,
"childSize": 0
}, {
"text": "目录5",
"children": null,
"nodeId": "5c3c510943121d0f628d4618",
"jumpable": true,
"childSize": 0
}, {
"text": "目录1",
"children": null,
"nodeId": "5c3c513b43121d0f628d461a",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c3c50e843121d0f628d4614",
"jumpable": true,
"childSize": 4
}, {
"text": "新能源测试",
"children": null,
"nodeId": "5c403e6b25f6695e24662e07",
"jumpable": true,
"childSize": 0
}, {
"text": "公共",
"children": [{
"text": "公司治理",
"children": null,
"nodeId": "5bf7cd2f882e6944ead96106",
"jumpable": true,
"childSize": 0
}, {
"text": "战略管理",
"children": null,
"nodeId": "5bf7cd26882e6944ead96105",
"jumpable": true,
"childSize": 0
}, {
"text": "公司营运管理",
"children": null,
"nodeId": "5bf7cd1d882e6944ead96104",
"jumpable": true,
"childSize": 0
}, {
"text": "科研管理",
"children": null,
"nodeId": "5bf7cd0c882e6944ead96103",
"jumpable": true,
"childSize": 0
}, {
"text": "市场开发与销售管理",
"children": null,
"nodeId": "5bf7cd01882e6944ead96102",
"jumpable": true,
"childSize": 0
}, {
"text": "安质环管理",
"children": null,
"nodeId": "5bf7cce5882e6944ead96100",
"jumpable": true,
"childSize": 0
}, {
"text": "资产经营管理",
"children": null,
"nodeId": "5bf7ccf2882e6944ead96101",
"jumpable": true,
"childSize": 0
}, {
"text": "人力资源管理",
"children": null,
"nodeId": "5bf7ccd3882e6944ead960ff",
"jumpable": true,
"childSize": 0
}, {
"text": "党委及干部管理",
"children": null,
"nodeId": "5bf7ca88882e6944ead960fe",
"jumpable": true,
"childSize": 0
}, {
"text": "企业文化官管理",
"children": null,
"nodeId": "5bf7ca73882e6944ead960fd",
"jumpable": true,
"childSize": 0
}, {
"text": "财务管理",
"children": null,
"nodeId": "5bf7ca65882e6944ead960fc",
"jumpable": true,
"childSize": 0
}, {
"text": "审计监察巡视管理",
"children": null,
"nodeId": "5bf7ca5b882e6944ead960fb",
"jumpable": true,
"childSize": 0
}, {
"text": "行政综合管理",
"children": null,
"nodeId": "5bf7ca40882e6944ead960fa",
"jumpable": true,
"childSize": 0
}, {
"text": "公共关系管理",
"children": null,
"nodeId": "5bf7ca1c882e6944ead960f9",
"jumpable": true,
"childSize": 0
}, {
"text": "品牌与宣传",
"children": null,
"nodeId": "5bf7c9ed882e6944ead960f8",
"jumpable": true,
"childSize": 0
}, {
"text": "信息化管理",
"children": null,
"nodeId": "5bf7c9e1882e6944ead960f7",
"jumpable": true,
"childSize": 0
}, {
"text": "法律事务管理",
"children": null,
"nodeId": "5bf7c9d6882e6944ead960f6",
"jumpable": true,
"childSize": 0
}, {
"text": "企业培训管理",
"children": null,
"nodeId": "5bf7c9b9882e6944ead960f5",
"jumpable": true,
"childSize": 0
}, {
"text": "党群管理",
"children": null,
"nodeId": "5bf7c9af882e6944ead960f4",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5bf7c7da882e6944ead960dc",
"jumpable": true,
"childSize": 19
}, {
"text": "太阳能",
"children": [{
"text": "樊非人为",
"children": [{
"text": "2",
"children": null,
"nodeId": "5c3d4ab325f669382f2c4229",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c3d490e25f669382f2c4227",
"jumpable": true,
"childSize": 1
}],
"nodeId": "5c3d4e5425f669382f2c422e",
"jumpable": true,
"childSize": 1
}, {
"text": "风能",
"children": [{
"text": "test",
"children": null,
"nodeId": "5c3db60225f6693e3fb0c4c3",
"jumpable": true,
"childSize": 0
}, {
"text": "测试2",
"children": null,
"nodeId": "5c3e86a225f6695ceffd0323",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c3d792625f669382f2c4250",
"jumpable": true,
"childSize": 2
}, {
"text": "测试",
"children": [{
"text": "测试3",
"children": null,
"nodeId": "5c3e87a525f6695ceffd0324",
"jumpable": true,
"childSize": 0
}],
"nodeId": "5c628d23f2b8b04c63da3e88",
"jumpable": true,
"childSize": 1
}],
"nodeId": "5c6bd00281c4a207675d31da",
"jumpable": true,
"childSize": 10
}]
var categoriesData = [];
var linksData = [];
var data = [];
function getCategoriesData(obj,size) {
if(obj.childSize !== 0) {
categoriesData.push({name : obj.text});
data.push({name: obj.text,category: obj.text,symbolSize:size,dataId:obj.nodeId});
for(var i=0; i<obj.childSize;i++) {
var child = obj.children[i];
linksData.push({source: obj.text,target: child.text, sourceId:obj.nodeId,targetId:child.nodeId});
if(child.childSize === 0) {
data.push({name: child.text,category: obj.text,dataId:child.nodeId});
}
var childSize = size - 20;
if(childSize < 20) {
childSize = 20;
}
getCategoriesData(child,childSize);
}
}
}
function getLinkData() {
for(var i=0; i<linksData.length;i++) {
var sourceId = linksData[i].sourceId;
var targetId = linksData[i].targetId;
for(var j=0; j<data.length;j++) {
if(data[j].dataId == sourceId){
linksData[i].source = j;
}
if(data[j].dataId == targetId){
linksData[i].target = j;
}
}
}
}
var root = getData[0];
getCategoriesData(root,110);
getLinkData();
option = {
backgroundColor:'#fff',
tooltip: {
formatter: '{b}'
},
animationDurationUpdate: 1500,
animationEasingUpdate: 'quinticInOut',
series: [
{
type: 'graph',
roam: true,
layout: 'force',
symbolSize: 50,
focusNodeAdjacency: true,
draggable : true,
categories: categoriesData,
data: data,
links: linksData,
label: {
normal: {
show: true,
textStyle: {
fontSize: 16,
fontStyle: '600'
},
}
},
lineStyle: {
normal: {
width: 4,
color: 'source',
curveness: 0,
type: "solid"
}
},
force: {
repulsion: 500,
gravity: 0.1,
edgeLength: 30,
layoutAnimation: true,
}
}
]
};
myChart.on("click", function(param) {
alert(param.name);
});