echarts链接:http://gallery.echartsjs.com/editor.html?c=xB1Sfo5JbX
代码:
option = { backgroundColor: 'black', color: ['#FFC90E', '#ED1C24'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, legend: { x: 'center', y: 'bottom', textStyle: { color: 'white', fontSize: 14 }, data: ['预警', '报警'] }, grid: { left: '0%', right: '0%', bottom: '13%', top: '16.5%', containLabel: true, }, xAxis: [{ type: 'category', axisTick: { alignWithLabel: true }, axisLine: { lineStyle: { color: 'white', } }, axisLabel: { show: true, color: 'white', textStyle: { fontSize: 18 } }, data: ['a', 'b', 'c'] }], yAxis: [{ splitLine: { show: false }, axisTick: { show: false }, axisLine: { lineStyle: { color: 'white', } }, axisLabel: { color: 'white', formatter: '{value}', textStyle: { fontSize: 18 } }, type: 'value' }], series: [{ name: '预警', type: 'bar', barWidth: '15%', data: [50, 66, 57], itemStyle: { normal: { label: { show: true, //开启显示 position: 'top', //在上方显示 textStyle: { //数值样式 color: 'white', fontSize: 16 } } } } }, { name: '报警', type: 'bar', barWidth: '15%', data: [23, 12, 26], itemStyle: { normal: { label: { show: true, //开启显示 position: 'top', //在上方显示 textStyle: { //数值样式 color: 'white', fontSize: 16 } } } } } ] };