原文地址:https://www.jianshu.com/p/9c6d94e57ab3
1 series: [ 2 { 3 label: { 4 show: true, 5 // labelText在bar外右上方 6 position: 'top', 7 // offset: [-11, -2], 8 // distance: -12, 9 color: '#37f8f5', 10 fontSize: '18', 11 fontWeight: 'bolder' 12 }, 13 // barGap: '100%', 14 // barCategoryGap: '50%', 15 barWidth: 40, // 修改柱狀圖的寬度 16 data: [{value: 0, deptCode: "JE0"}, {value: 1131, deptCode: "JE504"}],//!!!這里數組元素由數值改為對象,則value是原來的值,其他自定義屬性如deptCode可作為參數傳遞到點擊獲取的對象中 17 type: 'bar', 18 showBackground: true, 19 backgroundStyle: { 20 color: 'rgba(180, 180, 180, 0.2)' 21 }, 22 itemStyle: { 23 color: '#36adee', 24 emphasis: { 25 barBorderRadius: 1 26 }, 27 normal: { 28 // 漸變色 29 color: new echarts.graphic.LinearGradient( 30 0, 0, 0, 1, 31 [ 32 { offset: 0, color: '#FFFFFF' }, 33 { offset: 1, color: '#83f5de' } 34 ] 35 ), 36 shadowBlur: 20, 37 shadowColor: 'rgba(64,95,94,0.5)', 38 barBorderRadius: 5 39 } 40 } 41 } 42 ]