123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- //
- // 路径配置
- require.config({
- paths: {
- echarts: 'http://echarts.baidu.com/build/dist'
- }
- });
- var nodes = [];
- var links = [];
- var constMaxDepth = 2;
- var constMaxChildren = 7;
- var constMinChildren = 4;
- var constMaxRadius = 10;
- var constMinRadius = 2;
-
- nodes = [//展示的节点
- {
- "name": "齐悦科技",//节点名称
- "value": 43,
- "depth": 0,
- "id": 0,
- "category": 3//与关系网类别索引对应,此处只有一个关系网所以这里写0
- },
- {
- "name": "股权链",
- "value": 20,
- "category": 2,
- "depth": 1,
- "id": 1,
- },
- {
- "name": "信用链",
- "value": 20,
- "category": 2,
- "depth": 2,
- "id": 2,
- },
- {
- "name": "股东",
- "value": 10,
- "category": 1 ,
- "depth": 1,
- "id": 3
- },{
- "name": "愉悦投资66.67%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 4
- },{
- "name": "愉悦投资33.33%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 5
- },{
- "name": "供应链",
- "value": 20,
- "category": 2,
- "depth": 3,
- "id": 6,
- },
- {
- "name": "控股公司",
- "value": 10,
- "category": 1 ,
- "depth": 1,
- "id": 7
- },{
- "name": "愉悦家纺100%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 8
- },{
- "name": "东力热电45%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 9
- },{
- "name": "愉悦物流60%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 10
- },{
- "name": "居家悦品90%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 11
- },{
- "name": "黄河三角洲19.29%",
- "value": 3,
- "category": 0 ,
- "depth": 1,
- "id": 12
- },{
- "name": "关联公司",
- "value": 10,
- "category": 1 ,
- "depth": 2,
- "id": 13
- }
- ,{
- "name": "银行借款",
- "value": 10,
- "category": 1 ,
- "depth": 2,
- "id": 14
- },{
- "name": "银行授信",
- "value": 10,
- "category": 1 ,
- "depth": 2,
- "id": 15
- },{
- "name": "存续债券",
- "value": 10,
- "category": 1 ,
- "depth": 2,
- "id": 16
- },{
- "name": "担保类系链",
- "value": 10,
- "category": 1 ,
- "depth": 2,
- "id": 17
- },{
- "name": "滨印集团28%",
- "value": 3,
- "category": 0 ,
- "depth": 2,
- "id": 18
- },{
- "name": "17齐悦0183%",
- "value": 3,
- "category": 0 ,
- "depth": 2,
- "id": 19
- },{
- "name": "上游",
- "value": 10,
- "category": 1 ,
- "depth": 3,
- "id": 20
- },{
- "name": "下游",
- "value": 10,
- "category": 1 ,
- "depth": 3,
- "id": 21
- },{
- "name": "铜陵华源麻业9.86%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 22
- },{
- "name": "邹平泰升纺织7.31%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 23
- },{
- "name": "荆州福瑞源纺织6.93%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 24
- },{
- "name": "山东祥瑞祥纺织6.55%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 25
- },{
- "name": "江苏明源纺织6.31%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 26
- },{
- "name": "IKEA Supply AG18.45%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 27
- },{
- "name": "威海海思5.74%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 28
- },{
- "name": "圣美伦5.62%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 29
- },{
- "name": "威海润凡4.16%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 30
- },{
- "name": "宜家分拨(上海)3.79%",
- "value": 3,
- "category": 0 ,
- "depth": 3,
- "id": 31
- }
- ];
- links = [//节点之间连接
- {
- "source": 0,//起始节点,0表示第一个节点
- "target": 1,
- "weight": 1
- },
- {
- "source": 0,
- "target": 2
- },
- {
- "source": 0,//起始节点,0表示第一个节点
- "target": 6,
- "weight": 1
- },{
- "source": 1,
- "target": 3
- },{
- "source": 1,
- "target": 7
- },{
- "source": 3,
- "target": 4
- }
- ,{
- "source": 3,
- "target": 5
- },{
- "source": 7,
- "target": 8
- },{
- "source": 7,
- "target": 9
- },
- {
- "source": 7,
- "target": 10
- },{
- "source": 7,
- "target": 11
- },{
- "source": 7,
- "target": 12
- },{
- "source": 2,
- "target": 13
- },{
- "source": 2,
- "target": 14
- },{
- "source": 2,
- "target": 15
- },{
- "source": 2,
- "target": 16
- },{
- "source": 2,
- "target": 17
- },{
- "source": 17,
- "target": 18
- },{
- "source": 16,
- "target": 19
- },{
- "source": 6,
- "target": 20
- },{
- "source": 6,
- "target": 21
- },{
- "source": 20,
- "target": 22
- },{
- "source": 20,
- "target": 23
- },{
- "source": 20,
- "target": 24
- },{
- "source": 20,
- "target": 25
- },{
- "source": 20,
- "target": 26
- },{
- "source": 21,
- "target": 27
- },{
- "source": 21,
- "target": 28
- },{
- "source": 21,
- "target": 29
- },{
- "source": 21,
- "target": 30
- },{
- "source": 21,
- "target": 31
- },{
- "source": 21,
- "target": 32
- }
- ]
- for(var i=0; i<nodes.length; i++){
- if(nodes[i].id == "0"){
- nodes[i].itemStyle = {
- normal: {
- borderColor: '#000',
- color:'blue',
- label: {
- show: true,
- }
- }
- }
- }
- else if(nodes[i].id == "22"){
- nodes[i].itemStyle = {
- normal: {
- label: {
- show: true,
- textStyle:{
- color:'yellow'
- }
-
- },
- }
- }
- }
- //22
- nodes[i]["symbolSize"] = nodes[i].value *1.2;
- }
- console.log(nodes);
- require(
- [
- 'echarts',
- 'echarts/chart/force' // 使用柱状图就加载bar模块,按需加载
- ],
- function (ec) {
- // 基于准备好的dom,初始化echarts图表
- var guanxi = ec.init(document.getElementById('guanxi'));
- option3 = {
- title : {
- x:'right',
- y:'bottom'
- },
- tooltip : {
- trigger: 'item',
- formatter: '{b}'
- },
- toolbox: {
- show : true,
- feature : {
- restore : {show: true},
- magicType: {show: true, type: ['force', 'chord']},
- saveAsImage : {show: true}
- }
- },
- legend: {
- x: 'left',
- data:['四级','三级', '二级'],
- orient: 'left',
- x: 10,
- y: 10,
- textStyle: {
- fontSize: '14',
- color: '#fff'
- },
- },
- series : [
- {
- type:'force',
- name : "Force tree",
- ribbonType: false,
- categories : [
- {
- name: '四级'
- },
- {
- name: '三级'
- },
- {
- name: '二级'
- }
- ],
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle:{
- color:'#fff'
- }
- },
- nodeStyle : {
- brushType : 'both',
- borderColor : 'rgba(255,215,0,0.6)',
- borderWidth : 1
- }
- }
- },
- minRadius : constMinRadius,
- maxRadius : constMaxRadius,
- symbolSize: function (params) {
- console.log(params)
- },
- coolDown: 0.995,
- steps: 10,
- nodes : nodes,
- links : links,
- steps: 1
- }
- ]
- };
- console.log(option3)
- guanxi.setOption(option3);
- });
-
|