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
   | series:[     {         type: 'bar',         stack: 'Total',         itemStyle: {             borderRadius: [4, 4, 4, 4], // 圆柱             color: function (params) {                 //首先定义一个数组                 const colorList = [                     {                         x: 0,                         y: 1,                         x2: 0,                         y2: 0,                         colorStops: [{                             offset: 0, color: '#3BABFF' // 0% 处的颜色                         }, {                             offset: 1, color: '#7548FF' // 100% 处的颜色                         }],                         global: false // 缺省为 false                     }, "#514FA4", "#373948"];                 if (params.data.type == "达标") {                     return colorList[0]                 } else if (params.data.type == "未达标") {                     return colorList[1]                 } else {                     return colorList[2]                 }             },         },     } ]
   |