当悬浮到图表上面的时候Y轴会显示出来一个数值,我改变一下,让这个显示的数值加上一个符号。
配置项如下
option={
tooltip: {
trigger: 'axis',
formatter: function (params){
var res='';
for (var i = 0; i < params.length; i++) {
res+= params[i].seriesName + ' : ' + params[i].value+'%' + '<br/>';
}
return res;
},
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: [
'邮件营销',
'联盟广告',
'视频广告',
]
},
toolbox: {
feature: {
saveAsImage: {
}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [
'周一',
'周二',
'周三',
'周四',
'周五',
'周六',
'周日'
]
}
],
yAxis: [
{
axisLabel:{
formatter :function(a){
return a+"%";
}
}
},
{
type : 'value'
}
],
series: [
{
name: '邮件营销',
type: 'line',
stack: '总量',
areaStyle: {
normal: {
color: '#bce0eb'
}
},
itemStyle: {
normal: {
color: '#bce0eb'
}
},
data: [
12.0,
13.2,
10.1,
13.4,
9.0,
23.0,
21.0
]
},
{
name: '联盟广告',
type: 'line',
stack: '总量',
areaStyle: {
normal: {
color: '#00a5d5'
}
},
itemStyle: {
normal: {
color: '#00a5d5'
}
},
data: [
22.0,
18.2,
19.1,
23.4,
29.0,
33.0,
31.0
]
},
{
name: '视频广告',
type: 'line',
stack: '总量',
areaStyle: {
normal: {
color: '#006c8c'
}
},
itemStyle: {
normal: {
color: '#006c8c'
}
},
data: [
23.0,
12.2,
13.1,
18.4,
23.0,
25.0,
33.0
]
}
]
};