web123456

Echarts enables multi-group histogram overlapping legends to be available

option = { tooltip: { trigger: 'axis', formatter: (params, ticket, callback) => { let title = (params || [{'': 'unknown'}])[0].axisValueLabel let a = params.filter(_ => _.seriesName) .map(_ => `${_.seriesName} :: ${_.value}`) .join('</span><br/><span>'); return `<h2>${title}</h2><br/><span>${a}</span>`; }, axisPointer: { type: 'shadow', animation: true, shadowStyle: { color: { width: '100%', type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [ {offset: 0, color: 'RGBA(0,0,0,0)'}, {offset: 0.15, color: 'RGBA(0,0,0,0)'}, {offset: 0.15, color: 'RGBA(100,100,100,0.3)'}, {offset: 0.85, color: 'RGBA(100,100,100,0.3)'}, {offset: 0.85, color: 'RGBA(0,0,0,0)'}, {offset: 1, color: 'RGBA(0,0,0,0)'} ], global: false }, shadowColor: 'rgba(0, 0, 0, 0.5)', shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0, } } }, legend: { silent: true, data: ['Total number of buildings', 'Number of opening buildings', 'Total number of parking spaces', 'Number of opening parking spaces'], }, grid: {}, yAxis: { show: true, type: 'value', splitNumber: 5, min: 0 }, xAxis: [ { type: 'category', data: ['2012', '2013', '2014', '2015'] }, { show: false, type: 'category', data: ['', '', '', ''] }, { show: false, type: 'category', data: ['', '', '', ''] }, { show: false, type: 'category', data: ['', '', '', ''] } ], series: [ {name: 'Total number of buildings',type: 'bar',barWidth: '20%', data: [100, 100, 80, 80], xAxisIndex: 0}, {name: '',type: 'bar', show:false, barWidth: '20%', data: [0, 0, 0, 0], xAxisIndex: 0}, {name: '',type: 'bar',show:false, barWidth: '20%', data: [0, 0, 0, 0], xAxisIndex: 1}, {name: 'Total number of parking spaces',type: 'bar',barWidth: '20%', data: [100, 133, 80, 80], xAxisIndex: 1}, {name: 'Number of opening buildings',type: 'bar',barWidth: '20%', data: [50, 33, 44, 55], xAxisIndex: 2}, {name: '',type: 'bar',show:false, barWidth: '20%', data: [0, 0, 0, 0], xAxisIndex: 2}, {name: '',type: 'bar',show:false, barWidth: '20%', data: [0, 0, 0, 0], xAxisIndex: 3}, {name: 'Number of opening parking spaces',type: 'bar',barWidth: '20%', data: [22, 11, 10, 22], xAxisIndex: 3}, ] };