Echarts显示百分比的配置
var option1 = {
title: {
text: '召回率变化',
textAlign: 'right',
x: 'right',
y: 'top',
},
tooltip: {
trigger: 'axis',
formatter: '{b0}<br/>{a0}: {c0}%<br />{a1}: {c1}%<br />{a2}: {c2}%' // 显示百分比
},
legend: {
data: ['school recall', 'company recall', 'total recall']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: true, // x轴不从0刻度开始
data: dates // 日期
},
yAxis: {
type: 'value',
axisLabel: { // 显示百分比
show: true,
interval: 'auto',
formatter: '{value} %'
},
show: true,
scale: true // Y轴起始值为数据的最小值
},
dataZoom: {
show: true,
},
series: [
{
name: 'school recall',
type: 'line',
data: school_recall,
itemStyle: {
normal: {
label: {
show: true,
formatter: function (a, b, c) {
return a.data + "%";
}
}
}
}, // 显示每一个节点的数值,formatter规定节点数据加上%
},
{
name: 'company recall',
type: 'line',
data: company_recall,
itemStyle: {
normal: {
label: {
show: true,
formatter: function (a, b, c) {
return a.data + "%";
}
}
}
},
},
{
name: 'total recall',
type: 'line',
data: total_recall,
itemStyle: {
normal: {
label: {
show: true,
formatter: function (a, b, c) {
return a.data + "%";
}
}
}
},
},
]
};