关于Echarts柱状图顶部及折线图顶部自定义显示内容(数值和文字)
柱状图和折线图思路一样 知识type类型不一样
series:[
{
name: '成单率',
type: 'line',//或者 bar(柱状)
data: Arr,
itemStyle: {
normal: {
label: {
show:true,//是否显示
position: 'top',//显示位置
textStyle: { //文字样式
color: '#333'
font-weight:500,
...
},
formatter: function(params) {//核心部分 formatter 可以为字符串也可以是回调
if(params.value){//如果当前值存在则拼接
return params.value + '%'
}else{//否则返回个空
return '';
}
}
},
color:'#ee8b3f'//折线颜色设置
}
}
}
]