fix(图表): 组合图单个指标渲染错误

This commit is contained in:
wisonic-s
2025-08-19 19:39:46 +08:00
committed by wisonic-s
parent e7bd2d3a91
commit 792ee72a86
4 changed files with 27 additions and 22 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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',