echart1(){ this.box1Echart = this.$echarts.init(this.$refs.box1Dom) let colors = ['#f00', '#ff0', '#00f', '#0f0'] var option = { titile: { show: false, }, tooltip:{ trigger: 'item', formatter: '{b}' }, xAxis : [ { type : 'category', show: false, data : ['最多','平均','最少'], axisLabel: { interval :0 } } ], yAxis : [ { type : 'value', name:'数量', min: 0, max: 30, interval: 6, axisLabel: { formatter: '{value} 包' } } ], series : [ { name: '数量', type: 'bar', itemStyle: { normal: { color: function(params) { return colors[params.dataIndex] }, label: { show: true, position: 'top', formatter: '{b} {c}' } } }, barWidth:30, data: [28,15,9,4,7,8,23,11,17] } ] } this.box1Echart.setOption(option); }