echarts图例legend中name和数值设置为不同的颜色
作者:互联网
legend{ formatter: function(name) { var data = option.series[0].data; var tarValue = '' for (var i = 0; i < data.length; i++) { if (data[i].name == name) { tarValue = data[i].value; } } return "{name|" +name +"} {value|"+tarValue+"}"; }, textStyle:{ fontSize: 14, color: '#343D54', rich: { value: { color: '#1252AF', fontSize: 14, }, } }, }
标签:tarValue,name,color,value,图例,var,data,legend 来源: https://www.cnblogs.com/xhrr/p/16230014.html