tooltip: {
trigger: 'axis',
formatter: function (params) {
let htmlStr = '';
for (let i = 0; i < params.length; i++) {
const param = params[i];
const xName = param.name; //x轴的名称
const seriesName = param.name; //图例名称
const value = param.value; //y轴值
const color = param.color; //图例颜色
if (i === 0) {
htmlStr +='xzxxz:'+ xName + '<br/>'; //x轴的名称
}
htmlStr += '<div>';
//为了保证和原来的效果一样,这里自己实现了一个点的效果
htmlStr +=
'<span style="margin-right:5px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:' +
color +
';"></span>';
//圆点后面显示的文本
htmlStr +=
seriesName +
':' + value
// 文本颜色设置--2020-07-23(需要设置,请解注释下面一行)
htmlStr += '</div>';
}
return htmlStr;
},
},