原因是在同一时间有两条数据,处理方式在tooltip的formatter把数据放到set数组进行去重。
tooltip: {
trigger: 'axis',
formatter: function (params) {
const a = [];
const b =[];
const c =[];
var res = "<div><p>" + params[0].value[0] +"</p></div>";
for (var i = 0; i < params.length; i++) {
if (params[i].data != undefined) {
a.push(params[i].marker);
b.push(params[i].seriesName);
c.push(params[i].value[1]);
}
}
const seriesMakerList = [...new Set(a)];
const seriesNameList = [...new Set(b)];
const seriesValueList = [...new Set(c)];
for (let i = 0; i <3 ; i++) {
res += "<p>" +seriesMakerList[i]+ seriesNameList[i] + ":" + seriesValueList[i] + "</p>";
}
return res;
}
},