option = { tooltip: { trigger: 'item', formatter: function(params) { var res = params.name; var myseries = option.series; for (var i = 0; i < myseries.length; i++) { res += myseries[i].name + ' : ' + myseries[i].data[0] + '%</br>'; } return res; } }, grid: { top: '10%', left: '5%', right: '5%', bottom: '10%', }, xAxis: { type: 'value', show: false, }, yAxis: { type: 'category', show: false, axisTick: { show: false } }, series: [{ type: 'bar', name: '下跌', data: [30], stack: 'income', barWidth: 13, label: { normal: { show: true, position: 'left', //TODO offset: [40, 40], formatter: '{a}\n{c}%' } }, itemStyle: { normal: { color: '#00D176', barBorderRadius: [0, 0, 100, 0], } }, }, { type: 'bar', name: '平家', data: [20], stack: 'income', barWidth: 13, label: { normal: { show: true, position: 'left', //TODO offset: [40, 40], formatter: '{a}\n{c}%' } }, itemStyle: { normal: { color: '#E1DFDF', barBorderRadius: [100, 0, 100, 0], } }, }, { type: 'bar', name: '上涨', data: [50], stack: 'income', barWidth: 13, label: { normal: { show: true, position: 'right', //TODO offset: [-30, 40], formatter: '{a}\n{c}%' } }, itemStyle: { normal: { color: '#E63434', barBorderRadius: [100, 0, 0, 0], } } }] };