option = { tooltip: { show: false, trigger: 'axis', axisPointer: { type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow' } }, legend: { left: '3%' }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'value', axisLabel: { formatter: function (params) { return params + 'GB'; } } }, yAxis: { type: 'category', data: [''] }, series: [ { name: '标准存储时长所需存储空间', type: 'bar', stack: 'total', label: { show: true, formatter: function (params) { return ( '标准存储时长' + params.name + '天\n\n' + (params.value || 0) + 'GB' ); }, position: 'left', align: 'left', padding: [0, 0, 0, 20], color: '#0052D9', fontWeight: 600 }, barWidth: 120, emphasis: { focus: 'series' }, color: 'rgba(0,82,217, 0.1)', data: [{ name: 90, value: 100 }] }, { name: '警告存储时长所需存储空间', type: 'bar', stack: 'total', label: { show: true, formatter: function (params) { return ( '警告存储时长' + params.name + '天\n\n' + (params.value || 0) + 'GB' ); }, position: 'left', align: 'left', padding: [0, 0, 0, 20], color: '#00A870', fontWeight: 600 }, barWidth: 120, emphasis: { focus: 'series' }, color: 'rgba(0,168,112, 0.1)', data: [{ name: 90, value: 300 - 100 }] }, { name: '冗余存储空间', type: 'bar', stack: 'total', label: { show: true, formatter: function (params) { return ( '实际存储天数' + params.name + '天\n\n' + (params.value || 0) + 'GB' ); }, position: 'left', align: 'left', padding: [0, 0, 0, 20], color: '#ED7B2F', fontWeight: 600 }, barWidth: 120, emphasis: { focus: 'series' }, color: 'rgba(237,123,47, 0.1)', data: [{ name: 90, value: -300 }] }, { type: 'bar', name: '实际存储空间', stack: '1', label: { show: true, position: 'top', formatter: function (params) { return ''; } }, barWidth: 10, // barGap: 5, itemStyle: { color: '#A3A3A3', shadowColor: '#A3A3A3', barBorderRadius: [10, 0, 0, 0], emphasis: { color: '#A3A3A3' } }, data: [-300] }, { type: 'bar', name: '实际存储空间', stack: '1', label: { show: true, position: 'top', formatter: function (params) { return '实际存储空间'; } }, barWidth: 10, // barGap: 5, itemStyle: { color: '#A3A3A3', shadowColor: '#A3A3A3', barBorderRadius: [0, 10, 0, 0], emphasis: { color: '#A3A3A3' } }, data: [300] }, { type: 'bar', name: '标准存储时长所需存储空间', stack: '2', label: { show: true, position: 'top', formatter: function (params) { return '标准存储时长所需存储空间:' + (params.value || 0) + 'GB'; } }, barWidth: 10, // barGap:i==1?'-100%':'0', itemStyle: { color: '#0052D9', // barBorderRadius: [0, 20, 20, 0], // shadowBlur: [0, 0, 0, 20], shadowColor: '#0052D9', barBorderRadius: [10, 10, 0, 0], // shadowOffsetY: 100, // shadowOffsetX: -20, // barBorderRadius: legendData[i].barBorderRadius, emphasis: { color: '#0052D9' } }, data: [100] }, { type: 'bar', name: '警告存储时长所需存储空间', stack: '3', label: { show: true, position: 'top', formatter: function (params) { return '警告存储时长所需存储空间:' + (params.value || 0) + 'GB'; } }, barWidth: 10, // barGap: 2, itemStyle: { color: '#15AF7B', shadowColor: '#15AF7B', barBorderRadius: [10, 10, 0, 0], emphasis: { color: '#15AF7B' } }, data: [300] }, { type: 'bar', name: '冗余存储空间', stack: '3', label: { show: true, position: 'top', formatter: function (params) { return '冗余存储空间:' + (params.value || 0) + 'GB'; } }, barWidth: 10, barGap: 5, itemStyle: { color: '#ED7B2F', shadowColor: '#ED7B2F', barBorderRadius: [10, 10, 0, 0], emphasis: { color: '#ED7B2F' } }, data: [-300] } ] };