通过echart官方提供的测试页面进行了测试,在series[i]-graph.categories[i]上配置的series[i]-graph.categories[i].symbol的属性并不能生效。所以如果想达到期望效果只能通过series[i]-graph.data[i].symbol进行设置。测试了echarts2是可以生效的。
通过设置data.category能继承categories 的symbol样式
option = {
series : [{
name : '人物关系图',
type : 'graph',
layout : 'force',
categories : [
{
name: '人物',
symbol: 'pin'
},
{
name: '家人',
symbol: 'diamond'
},
{
name:'朋友',
symbol: 'arrow'
}
],
data : [
{category:0, name: '乔布斯', value : 10},
{category:1, name: '丽萨-乔布斯',value : 2},
{category:1, name: '保罗-乔布斯',value : 3},
{category:1, name: '克拉拉-乔布斯',value : 3},
{category:1, name: '劳伦-鲍威尔',value : 7},
{category:2, name: '史蒂夫-沃兹尼艾克',value : 5},
{category:2, name: '奥巴马',value : 8},
{category:2, name: '比尔-盖茨',value : 9},
{category:2, name: '乔纳森-艾夫',value : 4},
{category:2, name: '蒂姆-库克',value : 4},
{category:2, name: '龙-韦恩',value : 1},
],
links : [
{source : '丽萨-乔布斯', target:'乔布斯', weight : 1, name: '女儿'},
{source : '保罗-乔布斯', target : '乔布斯', weight : 2, name: '父亲'},
{source : '克拉拉-乔布斯', target : '乔布斯', weight : 1, name: '母亲'},
{source : '劳伦-鲍威尔', target : '乔布斯', weight : 2},
{source : '史蒂夫-沃兹尼艾克', target : '乔布斯', weight : 3, name: '合伙人'},
{source : '奥巴马', target : '乔布斯', weight : 1},
{source : '比尔-盖茨', target : '乔布斯', weight : 6, name: '竞争对手'},
{source : '乔纳森-艾夫', target : '乔布斯', weight : 1, name: '爱将'},
{source : '蒂姆-库克', target : '乔布斯', weight : 1},
{source : '龙-韦恩', target : '乔布斯', weight : 1},
{source : '克拉拉-乔布斯', target : '保罗-乔布斯', weight : 1},
{source : '奥巴马', target : '保罗-乔布斯', weight : 1},
{source : '奥巴马', target : '克拉拉-乔布斯', weight : 1},
{source : '奥巴马', target : '劳伦-鲍威尔', weight : 1},
{source : '奥巴马', target : '史蒂夫-沃兹尼艾克', weight : 1},
{source : '比尔-盖茨', target : '奥巴马', weight : 6},
{source : '比尔-盖茨', target : '克拉拉-乔布斯', weight : 1},
{source : '蒂姆-库克', target : '奥巴马', weight : 1}
],
edgeSymbol : ['none', 'arrow'],
roam: true,
bottom:50,
focusNodeAdjacency: true,
label : {
normal : {
show : true,
position : 'bottom'
}
},
force : {
layoutAnimation: false,
repulsion: 25,
gravity: 0.1,
edgeLength:6
}
}]
}
顶一个
遇到类似的问题
遇到同样的问题
这个问题在目前最新的版本都没有解决
不仅symbol没生效,symbolSize也一样
@pissang
Fixed in #9171 (But new version not published yet).
Most helpful comment
顶一个