echarts tooltip的formatter回调参数设置,两组参数情况

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38959210/article/details/82770019

如果series中右两组data;

series : [ {
				name : '销量',
				type : 'bar',
				data : [209,236,325,439,507,576,722,879,938,1364],
			}, {
				name : '增速',
				type : 'line',
				data : [1,13,37,35,15,12,25,21,6,44],
				label:{
					position:'top',
					show:true
				}
			} ],
	  tooltip:{
		show:true,
		formatter: function (params) { 
		for (var i = 0; i < option.series[0].data.length; i++) {	
 return "销量为:"+option.series[0].data[params.dataIndex]+"件"+"<br/>增速为:"+option.series[1].data[params.dataIndex]+"%";
					}
				
},

猜你喜欢

转载自blog.csdn.net/weixin_38959210/article/details/82770019