option = { grid: { left: '3%', right: '4%', bottom: '3%', top: '3%', containLabel: true, }, xAxis: { type: 'value', // max: 500, show: true, axisLabel: { show: false, }, // 不显示轴线 axisLine: { show: false }, // 不显示刻度线 axisTick: { show: false, }, splitLine: {// 网格线为虚线 show: true, }, }, yAxis: [ { type: 'category', inverse: true, splitLine: { show: true, }, axisTick: { show: false, }, axisLine: { show: false, }, axisLabel: { interval: 0, color: '#2C3E50', fontSize: 14 }, data: [1, 2, 3, 4, 5, 6] }, { type: 'category', inverse: true, splitLine: { show: false, }, axisTick: { show: false, }, axisLine: { show: false, }, axisLabel: { interval: 0, color: '#2C3E50', fontSize: 14 }, data: ['某某某某资产', '某某某某资产', ' 某某某某资产', ' 某某某某资产', ' 某某某某资产', '某某某某资产'] } ], series: [ { name: '房屋资产排名(3年)', type: 'bar', barWidth: 16, stack: 'stack', itemStyle: { normal: { color: function (params) { const { dataIndex } = params; let colorList = [ { color0: '#ED7B93', color1: '#FFB11A' }, { color0: '#3EB7CE', color1: '#00BEE7' }, ] return { type: "linear", x: 0, y: 0, x2: 1, y2: 0, colorStops: [ { offset: 0.3, color: colorList[dataIndex < 3 ? 0 : 1].color1 }, { offset: 0.7, color: colorList[dataIndex < 3 ? 0 : 1].color0 }, ], globalCoord: false } } }, }, data: [160, 103, 155, 100, 50, 30], }, ] };