echart修改tooltip增加單位
tooltip: {
trigger: 'axis',
formatter:'{b0}<br/>{a0}:{c0}'+元,//格式後面加單位
formatter:function(params){ //根據條件修改
console.log(params);
let unit = '個';
var relVal = params[0].name;
for (var i = 0; i < params.length; i++) {
if(i == 2) unit = '%'
relVal += '<div class="circle" ><span style="background:'+params[i].color+'"></span>'+ params[i].seriesName + ' : ' + params[i].value+unit+"</div>";
}
return relVal;
},
axisPointer: {
type: 'shadow',
label: {
}
}
// backgroundColor: 'rgba(92,201,173,0.8)' // 工具提示背景
}
若還想更多的詳情,請參考官網文檔
http://echarts.baidu.com/echarts2/doc/option.html#legend~renderAsImage