var data=['99.8', '99.3', '98','97.9','97.7','97.3', '97.3', '97','97','96.9']; var className=['李娟','张继','李楠','王晓鹏','赵亚南','康俊','赵静','李卓锦','王媛','李小娟']; var colorList=[ 'rgb(10,30,254)','rgb(40,60,254)','rgb(70,90,255)','rgb(100,120,244)','rgb(130,150,255)' ,'rgb(160,180,254)','rgb(190,210,254)','rgb(220,240,255)','rgb(250,270,244)','rgb(280,300,255)']; var defaultData=[130,130,130,130,130,130]; 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 + '<br/>' + "<span style='display:inline-block;margin-right:5px;width:9px;height:9px;background-color:#00FFFF'></span>" + // params[0].seriesName + ' : ' + Number((params[0].value.toFixed(4) / 10000).toFixed(2)).toLocaleString() + ' <br/>' params[0].seriesName + ' : ' + 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: false, axisLabel: { textStyle: { color: '#ffffff', fontSize: '12' }, formatter: function(value) { return value + ' %'; }, }, data: data }], series: [{ name: '分数', type: 'bar', zlevel: 1, itemStyle: { normal: { barBorderRadius: 0, color: (params) => { return colorList[params.dataIndex] } }, }, label: { show: true, position: 'top', // 位置 color: '#00FFFF', fontSize: 14, distance: 2 ,// 距离 formatter: '{c} 分', }, // 柱子上方的数值 barWidth: 8, data: data }, { name: '背景', type: 'bar', barWidth: 8, barGap: '-100%', data: defaultData, itemStyle: { normal: { color: '#1B375E', barBorderRadius: 0, } }, }, ] };