Merge pull request #4352 from dataease/pr@dev@refactor_tree-map-scroll

refactor(视图): Echarts矩形树图支持获取焦点再滚动
This commit is contained in:
王嘉豪 2023-01-11 17:18:28 +08:00 committed by GitHub
commit b1dadbcf1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -1021,6 +1021,7 @@ export const BASE_TREEMAP = {
{
// name: '',
type: 'treemap',
roam: true,
itemStyle: {
gapWidth: 2
},

View File

@ -128,6 +128,7 @@ export default {
showSuspension: true,
currentSeriesId: null,
haveScrollType: [
'treemap',
'map',
'chart-mix',
'bar',
@ -198,7 +199,13 @@ export default {
if (this.haveScrollType.includes(this.chart.type)) {
const opt = this.myChart.getOption()
this.adaptorOpt(opt)
this.myChart.setOption(opt)
if (this.chart.type === 'treemap') {
this.myChart.dispose()
this.myChart = null
this.preDraw()
} else {
this.myChart.setOption(opt)
}
}
},
adaptorOpt(opt) {
@ -218,6 +225,10 @@ export default {
opt.geo.roam = this.active
}
}
//
if (this.chart.type === 'treemap' && opt.series) {
opt.series[0].roam = this.active
}
},
changeSeriesId(param) {
const { id, seriesId } = param