最近做报表会频繁使用echarts图表,特此整理一下遇到的问题。方便自己以后快速查看。
1. 柱状图
(1)柱状图宽度:series--使用 barWidth 直接定义,
(2)柱状图上方显示数据,包括数据字体大小以及颜色 series--使用normal,具体使用如下:
series: [{
type: 'bar',
data: [
2.6,
5.9,
],
barWidth: 18, //柱状图宽度
itemStyle: {
normal: {
label: {
show: true, //开启显示
position: 'top', //数据在上方显示
textStyle: { //数值样式
color: '#31AAFF',
fontSize: 12
}
}
}
},
}]
效果图: