var result = result2.split("#");
var node = new String();
var lin = new String();
for(var i=0;i<result.length-1;i++)
{
var res = result[i];
var r = res.split("x");
node +="{category:1, name: '"+r[0]+"',value : '"+r[1]+"',itemStyle: {normal: {label: {show:false,},},},},";
lin +="{source : '"+tel+"', target : '"+r[0]+"', weight : 1, },";
}
var myChart = echarts.init(document.getElementById('main02'));
option = {
tooltip : {
trigger: 'item',
formatter: '{b} : {c}次'
},
legend: {
x: 'left',
data:[]
},
backgroundColor:'none',
series : [
{
type:'force',
name : "人物关系",
ribbonType: false,
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
color: '#000'//内容字颜色
}
},
nodeStyle : {
brushType : 'both',
borderColor : 'rgba(0,0,0,0.4)',
borderWidth : 0,
color:'#52b1f4'
}
},
emphasis: {
label: {
show: false
// textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
},
nodeStyle : {
//r: 30
},
linkStyle : {}
}
},
minRadius : 15,//最小圆
maxRadius : 35,//最大圆
gravity: 1.1,//动力
scaling: 1,//扩展
draggable: false,//拖拽
linkSymbol: 'arrow',//箭头类型
steps: 10,
coolDown: 0.9,
//preventOverlap: true,//防止重叠
nodes:[//图形设定
{
category:0, name: tel, value : 16,
draggable: true,
color: '#424242',
itemStyle: {
normal: {
color: '#004f86',
label: {
position: 'right',
textStyle: {
color: '#424242',
},
}
}
}
},
node
],
links : [
lin
]
}
]
};
myChart.setOption(option);
获取到的node和lin的值放进去显示有问题。但是我把弹出来的值复制一下放进去显示没问题了。。