tooltip配置
tooltip: {
show: true,
trigger: 'axis',
formatter: params => {
let result = `<div>${params[0].axisValue}</div>`
params.forEach(item => {
if (item.seriesType === 'line') {
result += `<div style="display: flex; width: 100%; margin-top: 4px; justify-content: space-between; align-items: center;">
<div>${item.marker}${item.seriesName}</div>
<div style="margin-left: 12px; color: #666; font-weight: 900;">${(item.value * 100).toFixed(2) + '%'}</div>
</div>`
} else {
result += `<div style="display: flex; width: 100%; margin-top: 4px; justify-content: space-between; align-items: center;">
<div>${item.marker}${item.seriesName}</div>
<div style="margin-left: 12px; color: #666; font-weight: 900;">${item.value}</div>
</div>`
}
})
return result
}
},
标签:自定义,tooltip,item,params,result,marker,echarts From: https://www.cnblogs.com/hong1/p/18546490