Merge pull request #7494 from dataease/pr@dev@fix_chart_render

Pr@dev@fix chart render
This commit is contained in:
wisonic-s 2024-01-02 16:06:13 +08:00 committed by GitHub
commit ec2b03e54a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 9 deletions

View File

@ -49,7 +49,7 @@ export function baseBarOption(chart_option, chart, activeParam) {
y.type = 'bar'
y.selectedMode = true
y.select = BASE_ECHARTS_SELECT
chart_option.legend.data.push(y.name)
chart_option.legend.data.push(y.name ?? 'null')
chart_option.series.push(y)
}
}
@ -117,7 +117,7 @@ export function horizontalBarOption(chart_option, chart) {
y.type = 'bar'
y.selectedMode = true
y.select = BASE_ECHARTS_SELECT
chart_option.legend.data.push(y.name)
chart_option.legend.data.push(y.name ?? 'null')
chart_option.series.push(y)
}
}

View File

@ -56,7 +56,7 @@ export function baseLineOption(chart_option, chart) {
y.label = customAttr.label
}
y.type = 'line'
chart_option.legend.data.push(y.name)
chart_option.legend.data.push(y.name ?? 'null')
chart_option.series.push(y)
}
}

View File

@ -3533,9 +3533,11 @@ export function getColors(chart, colors, reset) {
if (chart.data) {
const data = chart.data.data
const stackData = []
for (let i = 0; i < data.length; i++) {
const s = data[i]
stackData.push(s.category)
if (data?.length) {
for (let i = 0; i < data.length; i++) {
const s = data[i]
stackData.push(s.category)
}
}
const sArr = stackData.filter(function(item, index, stackData) {
return stackData.indexOf(item, 0) === index

View File

@ -145,7 +145,8 @@ export default {
'line-stack',
'scatter'
],
resizeTimer: null
resizeTimer: null,
renderTimer: null
}
},
@ -499,7 +500,11 @@ export default {
//
const chart = this.myChart
this.setBackGroundBorder()
setTimeout(chart.setOption(option, true), 500)
this.renderTimer && clearTimeout(this.renderTimer)
this.renderTimer = setTimeout(() => {
chart.clear()
chart.setOption(option, true)
}, 500)
window.removeEventListener('resize', chart.resize)
},
setBackGroundBorder() {

View File

@ -2114,7 +2114,8 @@ export default {
equalsAny(this.view.type, 'table-normal', 'table-info', 'map', 'text') || this.view.render === 'echarts' && includesAny(this.view.type, 'mix')
},
showFunctionCfg() {
return includesAny(this.view.type, 'bar', 'line', 'area', 'mix', 'table') ||
return includesAny(this.view.type, 'bar', 'line', 'area', 'mix') ||
(this.view.render === 'antv' && this.view.type.includes('table')) ||
equalsAny(this.view.type, 'map', 'text')
},
showScrollCfg() {