diff --git a/core/frontend/src/views/chart/chart/bar/bar.js b/core/frontend/src/views/chart/chart/bar/bar.js index 4bd33465fc..6d31642095 100644 --- a/core/frontend/src/views/chart/chart/bar/bar.js +++ b/core/frontend/src/views/chart/chart/bar/bar.js @@ -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) } } diff --git a/core/frontend/src/views/chart/chart/line/line.js b/core/frontend/src/views/chart/chart/line/line.js index 2fc4be2bcb..86681d9910 100644 --- a/core/frontend/src/views/chart/chart/line/line.js +++ b/core/frontend/src/views/chart/chart/line/line.js @@ -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) } } diff --git a/core/frontend/src/views/chart/chart/util.js b/core/frontend/src/views/chart/chart/util.js index 178a10625c..ceede3c23f 100644 --- a/core/frontend/src/views/chart/chart/util.js +++ b/core/frontend/src/views/chart/chart/util.js @@ -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 diff --git a/core/frontend/src/views/chart/components/ChartComponent.vue b/core/frontend/src/views/chart/components/ChartComponent.vue index 998a588792..01263b93e3 100644 --- a/core/frontend/src/views/chart/components/ChartComponent.vue +++ b/core/frontend/src/views/chart/components/ChartComponent.vue @@ -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() { diff --git a/core/frontend/src/views/chart/view/ChartEdit.vue b/core/frontend/src/views/chart/view/ChartEdit.vue index 1d947c2e5f..ec9e92290d 100644 --- a/core/frontend/src/views/chart/view/ChartEdit.vue +++ b/core/frontend/src/views/chart/view/ChartEdit.vue @@ -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() {