eacharts点击柱子调整 并截取括号内外的数据

77 阅读1分钟
  y轴的:      axisLabel: {

                      color: "#38454D",

                      fontSize: 13,

                      formatter: function (params) {
                      截取括号以外的内容展示

                        if (params) {

                          let str = params

                          let index1 = str.indexOf('(')

                          str = str.slice(0, index1)

                          return str;

                        } else {

                          return params;

                        }

                      },

                    },
                    
                    const vm = this

              option.tooltip.formatter = function (params) {

                console.log('params', params);

                if (params.seriesType === "bar") {

                  vm.$router.push({

                    path: "/bank/attitude/userportray",

                    query: {

                      fxName: params.name,

                    },

                  });

                }
                
                
                
                截取括号内的数据
                let str = this.$route.query.fxName

                      let index1 = str.indexOf('(')

                      let index2 = str.indexOf(')')

                      this.queryParams.workCode = str.substring(index1 + 1, index2)