You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/07/03 09:15:42 UTC

[GitHub] xiashuyuan commented on issue #8597: 关系图 data 的 name 属性不允许重复,会报错。

xiashuyuan commented on issue #8597: 关系图 data 的 name 属性不允许重复,会报错。
URL: https://github.com/apache/incubator-echarts/issues/8597#issuecomment-402069847
 
 
   已解决:
   1. 保持 data 中name不重复,用 value 或其他字段名称表示要展示的节点名称;
   2. 使用 label.formatter 输出节点名称;
   3. links 中 source 和 target 用数据项的索引值。
   
   option = {
   label:{
                   show: true,
                   formatter: function(value){
                       return value.data.value;
                   }
               },
               data: [{
                   // name: '节点1',
                   a: '`1',
                   value: 10,
                   x: 300,
                   y: 300,
               }, {
                   // name: '节点2',
                   value: 20,
                   x: 800,
                   y: 300
               }, {
                   // name: '节点3',
                   value: 10,
                   x: 550,
                   y: 100
               }, {
                   // name: '节点4',
                   value: 30,
                   x: 550,
                   y: 500
               }, {
                   name: '节点4',
                   value: 10,
                   x: 550,
                   y: 500
               }],
               // links: [],
               links: [{
                   source: 0,
                   target: 1,
                   symbolSize: [5, 20],
                   label: {
                       normal: {
                           show: true
                       }
                   },
                   lineStyle: {
                       normal: {
                           width: 5,
                           curveness: 0.2
                       }
                   }
               }],
   };

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org