1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
| studentHardData (val) { let yAxisData = [] let mySeriesData = [] let classSeriesData = [] let gradeSeriesData = [] let maxData = [] for (let item of this.studentHardData) { yAxisData.push(item.name) mySeriesData.push(item.score) classSeriesData.push(item.classAverageScore) gradeSeriesData.push(item.gradeAverageScore) maxData.push(100) }
let studentHardOption = { tooltip: { trigger: 'axis', formatter: function (resp) { let res = '' for (let i = 1; i < resp.length; i++) { let item = resp[i] res += `<p>${item.marker}${item.seriesName} : ${item.data}%</p>` } return res } }, legend: { selectedMode:false, orient: 'horizontal', x: 'center', y: 'bottom', data: [{ name: '我的得分率', textStyle: { fontSize: 12, color: '#999' } }, { name: '班级得分率', textStyle: { fontSize: 12, color: '#999', }, icon: 'image://data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAA/1JREFUWAnt\n' + 'V29sFEUU/729u72rPdp6pmAilmADGowmYkwbIKAUijQB5M8XojFGI5pgYjSRKJBoonwgajR8UVGJ\n' + 'Gj+Ajf8ogZM2Q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R+5lw3jPrIofoXntgz5DsOZvl9fYOWe5RMgmuZHNDY5fjlZ6ZJFnx4CQVLQnGolu\n' + 'p0UdZy8nwB+j5gNZae9Rr3Xo/jVweJtcWm7zx8vVoniADXrfhPE6texP0VBnq5cCKWSsjS5OflaO\n' + 'SbfPPtTW5LpOs2yfRmJW6U2uPpxmNvpE+Q9RN36MlrZnfLljLOEPXEltLt7/nfCrt6JyTeyOSRC+\n' + 'ryYtMWkJ3wJ+PRkT15YlJJMVf5+Cv8o+zKtQS0zQh3JF/9U0Il9fBX1lVfwLjHJP6c7uu4YAAAAA\n' + 'SUVORK5CYII=' }, { name: '年级得分率', textStyle: { fontSize: 12, color: '#999', }, icon: 'image://data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAA41JREFUWAnt\n' + 'WE1ME1EQntltLaVSQAUBCT/iD4HowWBAqnDAmJB4MHgy8aImegIEDQdPjYkHEgoCXkjUhJMajUYv\n' + 'XjxAISpSf0hERUGUIAZK1VaBguw+Zxd3A+0WuxUJJrx0d96bN2++b2fe250UK5xnrjJgtjXRaHPk\n' + 'Ocbhd2OMYUVHdRENDyAgSZZGqkRAxiPAFAC6STcADB8xI9xtLqx/rqzVK7HcWSUCA0QOypr2Ndxp\n' + 'cbUYeyf6ThJAJQPYGrZDhAccz51rtDm6w15DhnaXPdogEZAWccjJsnfyjYvAd+pxJNsy2C8KYkm5\n' + 's/o6cNC03mZ9Yke7qOWnprMmZkYUSujpT3imvr8wBBkxSAvShauQH4gdAQGOfOnw+iraq18xBC8C\n' + '81P6TORmrZRWvzibSunmJLfIoCeYRLiAf7BjDKwEWECRln7U5u5zy+b3KQtzSv338RdueHmpR/9C\n' + 'jRURR2KkbRh++mbg/a1+DbcUZgNC5qEszblAZUSRkAhMuacgYfdGMFoM8uV+NgbC9Kw6NlqMgVgh\n' + 'x7oj8bXXA0P3P0DOqR1g3RyrOh7tHoXE/CSI3RKn6sLt6CZhJZDs47ng9/hh4OY7FUdKTf+1PuDW\n' + '8LIuaU8yJBdtUucX6+gmwZt4iNseDyPtw2AwGyD9YKbsv6/1NaQUp4IllU4hNVN8lCzDuekmMd+p\n' + 'gd51SkqQXubRKRZ1PN/uT33dJPzjfvj6ygO+Aa+cks/OTzKGOC2Ap8cNkyMTKmZ8zjqI2mBWx6E6\n' + 'ukn8/DED3oFvdAYBzInmuT55F2dFmCACM7Q3lLY2PebfkIjJsEL2sVwFR5Wu812QVpoR0emI6D2h\n' + 'Ii9RR3c6QuFuO5oN0UmWUNOL6peMhHJKFkULMfl/pAMRpe3uouMwRDXAGCITaEznDhOAsSyqF3Lp\n' + 'Kx3+h0IjGprpoJpylurOezzPXUZObGsobKCaUruVP7ZbuWlfqYishsjs0rbS1ko4VPAMBpFgHN4w\n' + 'iVxtXXHdoPbShdrmAruPNDek63TnmTJBYBeogMleaBUwQpgkAleMPDoctvqPWN5eJZc59NSHL+51\n' + '3A4wj2hY2XE2nyJJVRXLouhYCEB62G8cMDfy3FNTlOFhbV6tV3EeFAll4m9k4766LlovXWG1FXE6\n' + 'VkkouVqNxGoklAgocnVPrLBI0GdMYiQyUZYKu+WUtCewlf6neWs0cx3LCTwf6xehLhzc6g4K0AAA\n' + 'AABJRU5ErkJggg==' } ] }, grid: { left: 20, top: 10, bottom: 50, containLabel: true }, xAxis: { type: 'value', axisLine: { lineStyle: { type: 'solid', color: '#E7EFFB', width: '1' } }, axisLabel: { formatter: '{value} %', textStyle: { color: '#999', fontSize: 10 } }, }, yAxis: { type: 'category', data: ['非常难', '很难', '中等', '简单'], axisLine: { lineStyle: { type: 'solid', color: '#fff', width: 1 } }, splitLine: { lineStyle: { color: ['#E7EFFB'], width: 1, type: 'solid' } }, axisLabel: { textStyle: { color: '#999' } } }, series: [{ type: 'bar', itemStyle: { normal: { color: '#D8D8D8', barBorderRadius: 10, } }, silent: true, barWidth: 16, barGap: '-100%', data: maxData }, { name: '我的得分率', itemStyle: { normal: { color: '#2393EB', barBorderRadius: 10, }, }, barWidth: 16, data: mySeriesData, type: 'bar' }, { name: '班级得分率', symbol: 'image://data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAA/1JREFUWAnt\n' + 'V29sFEUU/729u72rPdp6pmAilmADGowmYkwbIKAUijQB5M8XojFGI5pgYjSRKJBoonwgajR8UVGJ\n' + 'Gj+Ajf8ogZM2QCKCSg0aEg0aJKfB1Bbp3XHXdre3+3yz517L9qQ3JSF86Gx2Z97MvPd+896bebNk\n' + 'dS7bBcJ8M2TOp/s6zuO/wsxUONy20HXdVmYsBLiBCFNlOASmQSb0gfkMwThOoC/NpQdO+ry6NVld\n' + 'ra4oITKMNdGW5OfcvSEynE5tEBBPMzCrYoFEXQZos7kkeaJiHpnI3SuuCysAHpMsR9V2OtUtAO70\n' + '+nQ+zEuYuEUsu5vCxo7IvU3fE73klhPBR1dOsYeGWgB6zM5YP4bHTuKGsX2V9RQXxOu54Ky3u45n\n' + 'rc7Wn2WNGXHjkFg1CkZcudUetKYLbUgbxPRTGRCVKRxvFoNrZE6zUiTgLinScwmtDcIVAw87I0LM\n' + 'sPhRHPn8Rxex4p4oZk4LlRQk4gZiZtHbpc4yDW0QyZMWtrXnSqLe3ViLOTeH8XfaRccJC6dSw8gM\n' + 'MBJxwqbVcSyYY5bm/l9D/KJX2u6OYt/W6z2mw68k0NPvYOfBAY9+oDmGHY/Xoq7awN4tiYoAKEZt\n' + 'EIpJmV8VQxr9ecaFiyPuKY7ofbVBDFiMMz2Op+X0uWGk8y5qq/WUBmdrg1AAtn9ajImXP8njd6Hr\n' + 'a0JesB77xcbDb6bRn3Ox4IV/kOotgg0qDdLaIO6YEcZOCUZVPn6mDhdyjKbZEfx53sGDi6rw1pM1\n' + 'EhOE5IsJNNSP7JSg4tG0NojRzKr9xqNTkJejSAXjtDoD1TE5vCVW4rHi1g3OL0drb9HRQt7+Ko+7\n' + 'ZkZw+pyDW2+auChtS3wjft/4TlbiQFYsT1/Wxe6jg3hiWZWAKeC3vwooyGF2KlVAT7qymNCGP/2G\n' + 'EJ5dVY25t0S84/ghCcQt6+JovDGM5z7Iojfjem557YucnKAxrJs3flxog5gxNQT1qqLOi11P1ZaO\n' + '5lcfUelCv2i7I6iiktwQ5AnSVwwiKHAi9LjukOCzJf66JSX/IdbvlbbjulQlrqiXoGgU+nZJ1ZGJ\n' + 'KPd5yoIQBQW5R+5lw3jPrIofoXntgz5DsOZvl9fYOWe5RMgmuZHNDY5fjlZ6ZJFnx4CQVLQnGolu\n' + 'p0UdZy8nwB+j5gNZae9Rr3Xo/jVweJtcWm7zx8vVoniADXrfhPE6texP0VBnq5cCKWSsjS5OflaO\n' + 'SbfPPtTW5LpOs2yfRmJW6U2uPpxmNvpE+Q9RN36MlrZnfLljLOEPXEltLt7/nfCrt6JyTeyOSRC+\n' + 'ryYtMWkJ3wJ+PRkT15YlJJMVf5+Cv8o+zKtQS0zQh3JF/9U0Il9fBX1lVfwLjHJP6c7uu4YAAAAA\n' + 'SUVORK5CYII=', symbolSize: [30, 30], symbolOffset: ['50%', '-50%'], itemStyle: { normal: { color: '#6DC171', lineStyle: { color: 'rgba(255,255,255,0)' } }, }, barWidth: 16, data: classSeriesData, type: 'line' }, { name: '年级得分率', symbol: 'image://data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAA41JREFUWAnt\n' + 'WE1ME1EQntltLaVSQAUBCT/iD4HowWBAqnDAmJB4MHgy8aImegIEDQdPjYkHEgoCXkjUhJMajUYv\n' + 'XjxAISpSf0hERUGUIAZK1VaBguw+Zxd3A+0WuxUJJrx0d96bN2++b2fe250UK5xnrjJgtjXRaHPk\n' + 'Ocbhd2OMYUVHdRENDyAgSZZGqkRAxiPAFAC6STcADB8xI9xtLqx/rqzVK7HcWSUCA0QOypr2Ndxp\n' + 'cbUYeyf6ThJAJQPYGrZDhAccz51rtDm6w15DhnaXPdogEZAWccjJsnfyjYvAd+pxJNsy2C8KYkm5\n' + 's/o6cNC03mZ9Yke7qOWnprMmZkYUSujpT3imvr8wBBkxSAvShauQH4gdAQGOfOnw+iraq18xBC8C\n' + '81P6TORmrZRWvzibSunmJLfIoCeYRLiAf7BjDKwEWECRln7U5u5zy+b3KQtzSv338RdueHmpR/9C\n' + 'jRURR2KkbRh++mbg/a1+DbcUZgNC5qEszblAZUSRkAhMuacgYfdGMFoM8uV+NgbC9Kw6NlqMgVgh\n' + 'x7oj8bXXA0P3P0DOqR1g3RyrOh7tHoXE/CSI3RKn6sLt6CZhJZDs47ng9/hh4OY7FUdKTf+1PuDW\n' + '8LIuaU8yJBdtUucX6+gmwZt4iNseDyPtw2AwGyD9YKbsv6/1NaQUp4IllU4hNVN8lCzDuekmMd+p\n' + 'gd51SkqQXubRKRZ1PN/uT33dJPzjfvj6ygO+Aa+cks/OTzKGOC2Ap8cNkyMTKmZ8zjqI2mBWx6E6\n' + 'ukn8/DED3oFvdAYBzInmuT55F2dFmCACM7Q3lLY2PebfkIjJsEL2sVwFR5Wu812QVpoR0emI6D2h\n' + 'Ii9RR3c6QuFuO5oN0UmWUNOL6peMhHJKFkULMfl/pAMRpe3uouMwRDXAGCITaEznDhOAsSyqF3Lp\n' + 'Kx3+h0IjGprpoJpylurOezzPXUZObGsobKCaUruVP7ZbuWlfqYishsjs0rbS1ko4VPAMBpFgHN4w\n' + 'iVxtXXHdoPbShdrmAruPNDek63TnmTJBYBeogMleaBUwQpgkAleMPDoctvqPWN5eJZc59NSHL+51\n' + '3A4wj2hY2XE2nyJJVRXLouhYCEB62G8cMDfy3FNTlOFhbV6tV3EeFAll4m9k4766LlovXWG1FXE6\n' + 'VkkouVqNxGoklAgocnVPrLBI0GdMYiQyUZYKu+WUtCewlf6neWs0cx3LCTwf6xehLhzc6g4K0AAA\n' + 'AABJRU5ErkJggg==', symbolSize: [30, 30], symbolOffset: ['50%', '-50%'], itemStyle: { normal: { color: '#f8bb46', lineStyle: { color: 'rgba(255,255,255,0)' } }, }, barWidth: 16, data: gradeSeriesData, type: 'line' }] }
let barChart = echarts.init(document.getElementById('compareBar')) this.$nextTick(()=>{ barChart.setOption(studentHardOption) }) }
|