var ydata = ['上海', '北京', '深圳', '天津', '河南']; var salvProValue = [135, 144, 154, 181, 239]; option = { backgroundColor: '#fff', grid: { left: '2%', right: '4%', bottom: '2%', top: '2%', containLabel: true, }, tooltip: { trigger: 'axis', axisPointer: { type: 'none' }, formatter: '{b}:{c}', }, xAxis: { show: false, type: 'value', }, yAxis: { type: "category", data: ydata, axisLine: { show: false, }, axisTick: { show: false, }, axisLabel: { show: false }, }, series: [ { name: 'value', type: 'bar', zlevel: 1, showBackground: true, itemStyle: { normal: { barBorderRadius: [0, 20, 20, 0], // 圆角(左上、右上、右下、左下) color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [ 'red', 'yellow' ].map((color, offset) => ({ color, offset }))), // 渐变 }, }, label: { normal: { color: '#000', show: true, position: [0, '-20px'], textStyle: { fontSize: 16, }, formatter: '{b}', }, }, barWidth: 20, data: salvProValue, }, { name: '21', type: 'bar', barWidth: 20, barGap: '-100%', data: salvProValue, itemStyle: { normal: { color: '#f5f8ff', }, emphasis: { color: '#f5f8ff', }, }, label: { normal: { color: '#000', show: true, position:'right', distance: 4, textStyle: { fontSize: 16, }, formatter: '{c}', }, }, }, ], };