Echarts 的Formatter的回调函数

 option = {
tooltip: {
trigger: 'axis',
formatter: function (params,ticket,callback) {
let res = params[0].name;
for (let i = 0, l = params.length; i < l; i++) {
res += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + 'KB/s';
}
return res
},
axisPointer: {
type: 'shadow'
}
},
legend: {
itemGap: 15,
top: 20,
data: ['流出', '流入']
},
color: ['#5170ac', '#77acff'],
grid: {
left: '3%',
right: '4%',
bottom: '0%',
containLabel: true
},
xAxis: {
type: 'value',
position: 'top',
show : false,
},
yAxis: {
triggerEvent: true,
type: 'category',
inverse:true,
axisLabel: {
formatter: function (value) {
let res = value;
if (res.length > 5) {
res = res.substring(0, 4) + "..";
}
return res;
}
},
data: []
},
};
option = {
tooltip: {
trigger: 'axis',
formatter: function (params,ticket,callback) {
let res = params[0].name;
for (let i = 0, l = params.length; i < l; i++) {
res += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + 'KB/s';
}
return res
},
axisPointer: {
type: 'shadow'
}
},
legend: {
itemGap: 15,
top: 20,
data: ['流出', '流入']
},
color: ['#5170ac', '#77acff'],
grid: {
left: '3%',
right: '4%',
bottom: '0%',
containLabel: true
},
xAxis: {
type: 'value',
position: 'top',
show : false,
},
yAxis: {
triggerEvent: true,
type: 'category',
inverse:true,
axisLabel: {
formatter: function (value) {
let res = value;
if (res.length > 5) {
res = res.substring(0, 4) + "..";
}
return res;
}
},
data: []
},
};
上一篇:js取整并保留两位小数的方法


下一篇:Python如何发布程序