var data = [50, 60, 70, 20, 30, 10, 20, 23, 43, 52, 51]; var className = ['100+', '91-100', '81-90', '71-80', '61-70', '51-60', '41-50', '31-40', '21-30', '11-20', '0-10']; var defaultData = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]; option = { grid: { left: '5%', right: '5%', bottom: 25, top: 20, containLabel: true, }, backgroundColor: '#002D54', xAxis: { type: 'value', splitLine: { show: false }, axisTick: { show: false }, axisLabel: { // 改变x轴字体颜色和大小 textStyle: { color: "#80CFF0", fontSize: 16 } } }, yAxis: [ { type: 'category', inverse: true, axisLabel: { show: true, textStyle: { color: '#80CFF0', fontSize: '16', }, }, splitLine: { show: false, }, axisTick: { show: false, }, axisLine: { show: false, }, data: className, }, ], series: [ { name: '人数', type: 'bar', zlevel: 1, itemStyle: { normal: { barBorderRadius: 0, color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [ { offset: 0, color: 'rgba(0, 151, 251, 1)', }, { offset: 1, color: 'rgba(48, 236, 166, 1)', }, ]), }, }, label: { normal: { show: true, position: 'right', formatter: '{c}人', color: '#fff', fontSize: '16', } }, barWidth: 20, data: data, }, ], };