let xData = ["枯水期", "丰水期","平水期"] let seriesData = [ { name: "监测值", value: [95.04, 96.13, 94.76] }, { name: "标准值", value: [94.96, 96.02, 94.68] } ] let colorList = option = { "grid": { left: '4%', right: '6%', bottom: '15%', top: '23%', containLabel: true, }, "backgroundColor": "black", "color": ["#1DB750", "#C7F36A"], "tooltip": { "trigger": "axis", }, "legend": { "data": seriesData, right: '4%', top: '10%', align: 'left', "itemHeight": 10, icon: 'rect', itemWidth: 12, itemHeight: 12, "textStyle": { "fontSize": 14, color:"#fff" } }, "xAxis": { showBackground: true, nameTextStyle: { "color": "#c0c3cd", "padding": [0, 0, -10, 0], "fontSize": 14 }, axisLine: { show: true, //隐藏X轴轴线 lineStyle: { color: '#555f58' } }, axisLabel: { interval: 0, textStyle: { color: '#fff' //坐标轴字颜色 }, margin: 15 }, axisTick: { show: false //隐藏X轴刻度 }, splitLine: { //网格线 "show": false }, data: xData, type: "category" }, "yAxis":{ name: '单位:mg/L', nameTextStyle: { fontSize: 14, color: "#fff", }, axisLine: { show: true, //隐藏X轴轴线 lineStyle: { color: 'rgba(220,220,220,0.3)' } }, axisTick: { show: false //隐藏X轴刻度 }, axisLabel: { textStyle: { color: '#fff' } }, splitLine: { //网格线 "show": true, lineStyle: { color: 'rgba(220,220,220,0.3)' } } }, "series": function () { let series = [] for (let i = 0; i < seriesData.length; i++) { let serie = { "name": seriesData[i].name, "type": "bar", "barWidth": "13%", "data": seriesData[i].value } series.push(serie) } return series }() }