echarts icon indicating copy to clipboard operation
echarts copied to clipboard

当series 的type是graph时,使用edgeLabel自定义的formatter不起作用,只能通过在links里边每个连线的label属性单独设置

Open wade0817wang opened this issue 10 years ago • 3 comments

问题简述 (One-line summary)

当series 的type是graph时,使用edgeLabel自定义的formatter不起作用,只能通过在links里边每个连线的label属性单独设置

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version): 3.2.3
  • 浏览器类型和版本 (Browser version): chrome
  • 操作系统类型和版本 (OS Version):win7

重现步骤 (Steps to reproduce)

1.写代码实现一个graph图 2.通过series里边的edgeLabel自定义连线上显示的文字

期望结果 (Expected behaviour)

期望连线上变显示自定义格式的文字

可能哪里有问题 (What went wrong)

可能echarts库里边没有读取series->edgeLabel->normal->formatter属性

ECharts配置项 (ECharts option)

option = {
                backgroundColor: '#404a59',
                animation: true,
                animationDuration: 1000,
                animationEasing: 'cubicInOut',
                animationDurationUpdate: 1000,
                animationEasingUpdate: 'cubicInOut',
                legend: {
                    right: 10,
                    selectedMode: 'single',
                    data: ['慢速率', '命中率']
                },
                tooltip: {
                    trigger: 'item',
                    hideDelay: 3000,
                    enterable: true,
                    //position: 'bottom',
                    //alwaysShowContent: true,
                    show: true,
                    formatter: function(params){
                        console.log(params); 
                        return params.name;
                    }
                },
                title: {
                    text: '例子',
                    shadowBlur: 10
                },
                visualMap:[{        //根据不同维度的数据,产生不同的视觉效果
                    type: 'continuous',
                    min: 0,
                    max: 100,
                    range:[0,100],
                    calculable: true,
                    realtime: true,
                    text:['最大值','最小值'],
                    inRange:{
                        symbolSize:[20,80]
                    },
                    dimension: 0,
                    seriesIndex: 0,
                    show: true
                }],
                series: [{
                    name: '慢速率',
                    type: 'graph',
                    legendHoverLink: true,
                    hoverAnimation: true,
                    layout:'none',
                    roam: true, //是否开始鼠标缩放
                    nodeScaleRatio:  0, //节点缩放
                    focusNodeAdjacency: true,   //是否在鼠标移动到节点上的时候显示界定啊以及节点的边和邻接节点
                    symbol: 'circle',   //节点显示图形,可自定义设置图
                    symbolSize: 50, //节点图标大小
                    itemStyle: {
                        normal: {
                            shadowBlur: 10,
                            shadowColor: 'rgba(120, 36, 50, 0.5)',
                            shadowOffsetY: 5,
                            color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
                                offset: 0,
                                color: 'rgb(251, 118, 123)'
                            }, {
                                offset: 1,
                                color: 'rgb(204, 46, 72)'
                            }])
                        }
                    },
                    symbolOffset: [0,0],    //图标偏移
                    edgeSymbol: ['none', 'arrow'],  //边两端的标记类型
                    edgeSymbolSize: 20, //边两端的标记大小
                    label: {
                        normal: {
                            show: true,
                            formatter: function(params){
                                return '节点名称:'+params.name + '\n' + 
                                       '慢速率:' + (params.value)[1] + '\n' +
                                       '带宽:' + (params.value)[0];
                            },
                            position:'insideLeft'
                        }
                    },
                    edgeLabel: {
                        normal: {
                            show: true,
                            formatter: function(params){
                                return '线路:'+params.name + '\n' + 
                                       'RTT:' + (params.value)[5] + '\n' +
                                       '丢包率:' + (params.value)[4] + '\n' +
                                       '带宽:' + (params.value)[0];
                            },
                            position:'middle'
                        }
                    },
                    data: dataObj.data,
                    links: dataObj.links
                }]
}

其他信息 (Other comments)

wade0817wang avatar Sep 11 '16 16:09 wade0817wang

也遇到了同样问题。

whereamazinghappen avatar Nov 18 '16 03:11 whereamazinghappen

我也遇到了同样的问题,希望早点解决

hongxingwz avatar Dec 06 '16 02:12 hongxingwz

2020了,还没解决吗老哥们

gagashuai0 avatar Jun 05 '20 08:06 gagashuai0