option = { legend:{ show: true }, tooltip: { trigger: 'item', formatter: function() { var res = ''; var myseries = option.series; for (var i = 0; i < myseries.length; i++) { if (myseries[i].name) { 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, }, { type: 'category', 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], }, shadowColor: '#00D176' }, }, { 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', } }, }, { type: 'bar', name: '上涨', data: [50], stack: 'income', barWidth: 13, label: { show: true, //color: '#fff', position: 'left', // right inside //TODO offset: [40, 40], formatter: '{a}\n{c}%' }, itemStyle: { normal: { color: '#E63434', } } }, { type: 'bar', sname: '下跌', yAxisIndex: 1, data: [30], stack: 'income1', barWidth: 36, label: { show: false }, itemStyle: { normal: { color: 'rgba(0, 209, 118, 0.2)', }, shadowColor: '#00D176' }, }, { type: 'bar', sname: '平家', data: [20], yAxisIndex: 1, stack: 'income1', barWidth: 36, label: { show: false }, itemStyle: { normal: { color: 'rgba(225, 223, 223, 0.2)', } }, }, { type: 'bar', sname: '上涨', yAxisIndex: 1, data: [50], stack: 'income1', barWidth: 36, label: { show: false }, itemStyle: { normal: { color: 'rgba(230, 52, 52, 0.2)', } } }, ] };