echarts自定义tooltip显示内容
tooltip: {
trigger: "axis",
formatter: function (params) {
var result = params[0].name;
params.forEach(function (item) {
result += "<br/>";
result +=
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
item.color +
'"></span>';
result += item.seriesName + ":";
result += isNaN(item.value) ? 0 : item.value;
});
return result;
},
},
修改前:
修改后: