diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-dual-line.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-dual-line.ts index c0c2c03eea..4377701320 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-dual-line.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-dual-line.ts @@ -93,7 +93,8 @@ export class GroupLineMix extends G2ChartView { } const [left] = cloneDeep(chart.data?.left?.data) const [right] = cloneDeep(chart.data?.right?.data) - + const leftData = left?.data || [] + const rightData = right?.data || [] // options const initOptions: G2Spec = { type: 'spaceFlex', @@ -110,7 +111,7 @@ export class GroupLineMix extends G2ChartView { type: 'line', data: { type: 'inline', - value: left.data, + value: leftData, transform: [ { type: 'map', @@ -141,7 +142,7 @@ export class GroupLineMix extends G2ChartView { }, { type: 'point', - data: left.data, + data: leftData, encode: { x: 'field', y: 'value', @@ -156,7 +157,7 @@ export class GroupLineMix extends G2ChartView { }, { type: 'line', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -180,7 +181,7 @@ export class GroupLineMix extends G2ChartView { }, { type: 'point', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -200,8 +201,8 @@ export class GroupLineMix extends G2ChartView { const newChart = new G2Chart({ container }) const options = this.setupOptions(chart, initOptions, { chartObj: newChart, - leftData: left.data, - rightData: right.data + leftData, + rightData }) newChart.on('point:click', action) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-group.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-group.ts index 47526e5fa3..0d9a71919a 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-group.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-group.ts @@ -92,6 +92,8 @@ export class GroupLineMix extends G2ChartView { } const [left] = cloneDeep(chart.data?.left?.data) const [right] = cloneDeep(chart.data?.right?.data) + const leftData = left?.data || [] + const rightData = right?.data || [] // options const initOptions: G2Spec = { @@ -109,7 +111,7 @@ export class GroupLineMix extends G2ChartView { type: 'interval', data: { type: 'inline', - value: left.data, + value: leftData, transform: [ { type: 'map', @@ -137,7 +139,7 @@ export class GroupLineMix extends G2ChartView { }, { type: 'line', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -161,7 +163,7 @@ export class GroupLineMix extends G2ChartView { }, { type: 'point', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -181,8 +183,8 @@ export class GroupLineMix extends G2ChartView { const newChart = new G2Chart({ container }) const options = this.setupOptions(chart, initOptions, { chartObj: newChart, - leftData: left.data, - rightData: right.data + leftData, + rightData }) newChart.on('point:click', action) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-stack.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-stack.ts index 8aead0a43e..9406a0ff05 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-stack.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix-stack.ts @@ -92,7 +92,8 @@ export class StackLineMix extends G2ChartView { } const [left] = cloneDeep(chart.data?.left?.data) const [right] = cloneDeep(chart.data?.right?.data) - + const leftData = left?.data || [] + const rightData = right?.data || [] // options const initOptions: G2Spec = { type: 'spaceFlex', @@ -109,7 +110,7 @@ export class StackLineMix extends G2ChartView { type: 'interval', data: { type: 'inline', - value: left.data, + value: leftData, transform: [ { type: 'map', @@ -137,7 +138,7 @@ export class StackLineMix extends G2ChartView { }, { type: 'line', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -161,7 +162,7 @@ export class StackLineMix extends G2ChartView { }, { type: 'point', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -181,8 +182,8 @@ export class StackLineMix extends G2ChartView { const newChart = new G2Chart({ container }) const options = this.setupOptions(chart, initOptions, { chartObj: newChart, - leftData: left.data, - rightData: right.data + leftData, + rightData }) newChart.on('point:click', action) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix.ts index ea0fec1653..d150897353 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/g2/mix/mix.ts @@ -81,7 +81,8 @@ export class ColumnLineMix extends G2ChartView { } const [left] = cloneDeep(chart.data?.left?.data) const [right] = cloneDeep(chart.data?.right?.data) - + const leftData = left?.data || [] + const rightData = right?.data || [] // options const initOptions: G2Spec = { type: 'view', @@ -91,7 +92,7 @@ export class ColumnLineMix extends G2ChartView { type: 'interval', data: { type: 'inline', - value: left.data, + value: leftData, transform: [ { type: 'map', @@ -121,7 +122,7 @@ export class ColumnLineMix extends G2ChartView { }, { type: 'line', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value', @@ -142,7 +143,7 @@ export class ColumnLineMix extends G2ChartView { }, { type: 'point', - data: right.data, + data: rightData, encode: { x: 'field', y: 'value',