vue中echarts折线图双折线,鼠标悬浮时间,将两个X轴的内容以及Y轴的内容全部显示出来:
只要修改一个地方,用formatter方法
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
padding: [5, 10],
formatter: function(params, ticket, callback) {
return that.drawLineData.xAxis[params[0].dataIndex] + "<br />" + params[0].seriesName + ":" + params[0].value+ "<br />"+that.drawLineData.compareTime[params[1].dataIndex] + "<br />" + params[1].seriesName + ":" + params[1].value;
}
}
其中that.drawLineData.xAxis和that.drawLineData.compareTime分别为两个X轴的数组