|
@@ -82,18 +82,36 @@ export default {
|
|
|
initChart() {
|
|
|
const chartDom = this.$refs.reportEcharts;
|
|
|
this.chart = this.$echarts.init(chartDom)
|
|
|
- this.chart.on('click',(params)=>{
|
|
|
- var obj = this.reportType.find(item=>{
|
|
|
- return item.label == params.name
|
|
|
- })
|
|
|
- localStorage.reportType = obj.value
|
|
|
- this.$router.push({
|
|
|
- name:'AllReport',
|
|
|
- })
|
|
|
- setTimeout(function () {
|
|
|
- localStorage.removeItem('reportType')
|
|
|
- }, 1000);
|
|
|
+ this.chart.getZr().off('click')
|
|
|
+ this.chart.getZr().on('click',(params)=>{
|
|
|
+ let pointInPixel = [params.offsetX, params.offsetY]
|
|
|
+ if (this.chart.containPixel('grid', pointInPixel)) {
|
|
|
+ let xIndex = this.chart.convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
|
|
|
+ let xData = this.chart.getOption().xAxis[0].data[xIndex]
|
|
|
+ var obj = this.reportType.find(item=>{
|
|
|
+ return item.label == xData
|
|
|
+ })
|
|
|
+ localStorage.reportType = obj.value
|
|
|
+ this.$router.push({
|
|
|
+ name:'AllReport',
|
|
|
+ })
|
|
|
+ setTimeout(function () {
|
|
|
+ localStorage.removeItem('reportType')
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
})
|
|
|
+ // this.chart.on('click',(params)=>{
|
|
|
+ // var obj = this.reportType.find(item=>{
|
|
|
+ // return item.label == params.name
|
|
|
+ // })
|
|
|
+ // localStorage.reportType = obj.value
|
|
|
+ // this.$router.push({
|
|
|
+ // name:'AllReport',
|
|
|
+ // })
|
|
|
+ // setTimeout(function () {
|
|
|
+ // localStorage.removeItem('reportType')
|
|
|
+ // }, 1000);
|
|
|
+ // })
|
|
|
this.chart.setOption({
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|