tooltip: {
trigger: 'axis',
formatter: function (params) {
let str = `${params[0].axisValue}<br/>`
params.map(item => {
if (item.data) {
str += `<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${item.color};\">
</span>${item.seriesName}:${item.data}<br/>`
}
})
return str
},
},
echarts示例
formatter: '{b0}: {c0}<br />{b1}: {c1}'