/** * 堆叠条形图 */ var echartsechartsbar1 = echarts.init(document.getElementById('echartsbar1'), 'walden'); var optionechartsbar1 = { title: { text: '2小时计划达成', left: 'center' }, tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, legend: { data: ['实际', '目标'], left: 'left' }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { // type: 'value' }, yAxis: { type: 'category', data: ['08:00-10:00', '10:00-12:00', '13:00-15:00', '17:00-19:00', '20:00-22:00'] }, series: [ { name: '实际', type: 'bar', stack: '总量', label: { show: true, position: 'insideRight' }, data: [59, 65, 62, 61, 63] }, { name: '目标', type: 'bar', stack: '总量', label: { show: true, position: 'insideRight' }, data: [60, 60, 60, 60, 60] } ] }; echartsechartsbar1.setOption(optionechartsbar1);