关系图中,节点图片设置的形状问题
One-line summary [问题简述]
关系图中,当节点的symbol: 'image://http://www.damndigital.com/wp-content/uploads/2010/12/steve-jobs.jpg',这样设置时,节点的形状会是图片的矩形形状这样很丑。
详情请见: http://gallery.echartsjs.com/editor.html?c=xBJrjgRBM-
Version & Environment [版本及环境]
- ECharts version [ECharts 版本]: 最新
- Browser version [浏览器类型和版本]: chrome最新
- OS Version [操作系统类型和版本]: win7
Expected behaviour [期望结果]
当节点设置成图片时,能设置节点的形状是圆形。 期待结果如下图
ECharts option [ECharts配置项]
option = {
tooltip: {
show: false
},
legend: {
x: "center",
data: ["家人", "朋友"]
},
animation: false,
series: [{
categories: [{
name: '家人',
itemStyle: {
normal: {
color: "#009800",
}
}
}, {
name: '朋友',
itemStyle: {
normal: {
color: "#4592FF",
}
}
}],
type: 'graph',
layout: 'force',
symbol: "circle",
symbolSize: 50,
roam: true, //禁止用鼠标滚轮缩小放大效果
edgeSymbol: ['circle', 'arrow'],
edgeSymbolSize: [0, 10],
// 连接线上的文字
focusNodeAdjacency: true, //
edgeLabel: {
normal: {
show: true,
textStyle: {
fontSize: 20
},
formatter: "{c}"
}
},
categories: [{
name: '家人',
itemStyle: {
normal: {
color: "#009800",
}
}
}, {
name: '朋友',
itemStyle: {
normal: {
color: "#4592FF",
}
}
}],
lineStyle: {
normal: {
opacity: 1,
width: 2,
curveness: 0
}
},
// 圆圈内的文字
label: {
normal: {
show: true
}
},
force: {
repulsion: 5000
},
data: [{
name: '节点1',
symbol: 'image://http://louruyue.notbad.cn/uploadimage/pic_201251143747.jpg',
itemStyle: {
normal: {
color: '#f90', //圆点的颜色
label: {
position: 'bottom',
textStyle: {
color: '#f90'
}
}
}
},
}, {
name: '节点2',
category: 1,
itemStyle: {
normal: {
color: '#090',
},
emphasis: {
color: "#000"
}
}
}, {
name: '节点3',
category: 1,
draggable: true,
}, {
name: '节点4',
category: 0,
draggable: true,
}, {
name: '节点5',
category: 0,
draggable: true,
}, {
name: '节点6',
category: 0,
draggable: true,
}],
links: [{
source: '节点1',
target: '节点2',
value: "朋友",
lineStyle: {
normal: {
color: '#38f',
curveness: 0 // 线的弯曲度 0-1之间 越大则歪曲度更大
}
},
label: {
normal: {
textStyle: {
color: '#07ac72'
}
}
}
}, {
source: '节点1',
target: '节点3',
value: "朋友"
}, {
source: '节点1',
target: '节点4',
value: "家人"
}, {
source: '节点1',
target: '节点5',
value: "家人"
}, {
source: '节点1',
target: '节点6',
value: "家人"
}, ]
}]
}
Other comments [其他信息]
期待结果如下:

可以先将图片在html某个地方设置成圆形,再转为canvas导出dataURL填充进去。。。不过还是希望官方能增个设置图片节点圆形的属性
业务上有需求,写了个示例,写完了同事说github上有人问这个问题,希望能帮到你。http://gallery.echartsjs.com/editor.html?c=x7rk_-y1Yd
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!