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: '', // name: '',
type: 'treemap', type: 'treemap',
roam: true,
itemStyle: { itemStyle: {
gapWidth: 2 gapWidth: 2
}, },

View File

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