fix: 抽取修改别名方法为全局 修改正则

This commit is contained in:
zhangyu
2021-11-17 18:24:30 +08:00
parent c76c0511c9
commit 170b6a4749
13 changed files with 40 additions and 209 deletions

View File

@@ -640,27 +640,6 @@ export default {
}, 100)
})
},
dealLegendAlias: function (legend, expression) {
if (/\{\{.+\}\}/.test(expression)) {
const labelValue = expression.replace(/(\{\{.+?\}\})/g, function (i) {
const label = i.substr(i.indexOf('{{') + 2, i.indexOf('}}') - i.indexOf('{{') - 2)
const reg = new RegExp(',' + label + '=".+?"')
const reg1 = new RegExp('{' + label + '=".+?"')
let value = null
if (reg.test(legend)) {
const find = legend.match(reg)[0]
value = find.substr(find.indexOf('"') + 1, find.lastIndexOf('"') - find.indexOf('"') - 1)
} else if (reg1.test(legend)) {
const find = legend.match(reg1)[0]
value = find.substr(find.indexOf('"') + 1, find.lastIndexOf('"') - find.indexOf('"') - 1)
}
return value || label
})
return labelValue
} else {
return expression
}
},
clickLegend (legendName, index) {
/* 点击legend
* 1.当前如果是全高亮状态则全部置灰只留被点击的legend高亮