var data=[50, 60, 70,20,30,10,50, 60, 70,20,30,10]; var className=['1年级','2年级','3年级','4年级','5年级','6年级','1年级','2年级','3年级','4年级','5年级','6年级']; var color=['#39B3FF']; option = { grid: { left: '5%', right: '5%', bottom: '5%', top: '10%', containLabel: true }, tooltip: { trigger: 'axis', axisPointer: { type: 'none' }, formatter: function(params) { return params[0].name +':'+ params[0].value } }, backgroundColor: 'rgb(20,28,52)', xAxis: { show: false, type: 'value' }, yAxis: [{ type: 'category', inverse: true, axisLabel: { show: true, textStyle: { color: '#fff' }, }, splitLine: { show: false }, axisTick: { show: false }, axisLine: { show: false }, data: className }, { type: 'category', inverse: true, axisTick: 'none', axisLine: 'none', show: true, axisLabel: { textStyle: { color: '#ffffff', fontSize: '12' }, formatter: function(value) { return value + ' %'; }, }, data: data }], series: [{ type: 'bar', zlevel: 1, itemStyle: { normal: { barBorderRadius: 0, color: color }, }, barWidth: 10, data: data }, { name: '背景', type: 'bar', barWidth: 10, barGap: '-100%', data: [100,100,100,100,100,100], itemStyle: { normal: { color: '#1B375E', barBorderRadius: 0, } }, }, ] };