业务:
按年统计数据。
1、如果点击某一年,自动跳转到这一年的具体12个月的数据分布显示。
2、如果点击某个月,自动跳转到这个月的具体数据分布显示。
年统计页面
月:
日:
echarts的点击事件触发:
myBarChart.on('click', function (param) {console.log(param);//这里根据param填写你的跳转逻辑});
echarts图形点击事件多次触发问题解决
myBarChart.off('click');
我的代码:
drawBarCharts() {myBarChart.off('click');//这个是解决多次触发问题的关键let option = {/*鼠标滚动缩放*/dataZoom: [{type: 'slider',/*start: 20,end: 50,*/maxValueSpan: 20,handleSize: 8},{type: 'inside',filterMode: 'weakFilter'}],/*color: ['rgba(180,88,66,0.96)', '#39a479', '#6A6A6A'],*/color: ['#ff3c3c','#39a479'],/*指示器*/tooltip: {trigger: 'axis',axisPointer: {//type: 'shadow'type: 'line'}},legend: {data: [t('sline.label.sumCapability'), t('sline.label.remainCapability'), t('sline.label.usedCapability')]},grid: {left: '3%',right: '4%',bottom: '12%',containLabel: true},xAxis: [{type: 'category',axisLabel: {//坐标轴刻度标签的相关设置。rotate: "25"},data: this.dailydate}],yAxis: [{type: 'value'}],toolbox: {show: true,top: '15',feature: {mark: {show: true},dataView: {show: true, readOnly: false},magicType: {show: true, type: ['line', 'bar']},restore: {show: true},saveAsImage: {show: true}}},series: [/* {name: t('sline.label.sumCapability'),type: 'bar',barMaxWidth: 50,data: this.allCapa},*/{name: t('sline.label.usedCapability'),type: 'bar',barMaxWidth: 50,stack: 'capability',z: 2,label: {show: true,offset: [0, -5]},data: this.beUsedCapa},{name: t('sline.label.remainCapability'),type: 'bar',barMaxWidth: 50,stack: 'capability',z: 1,label: {show: true},data: this.avaCapa},]};myBarChart.setOption(option);myBarChart.on('click', function (param) {console.log(param);//这里根据param填写你的跳转逻辑});/*window.addEventListener('resize', function () {myBarChart.resize()});this.$forceUpdate();*/},