diff --git a/common/changes/@visactor/vtable/2749-bug-stack-no-work-in-vtable_2024-11-04-07-44.json b/common/changes/@visactor/vtable/2749-bug-stack-no-work-in-vtable_2024-11-04-07-44.json new file mode 100644 index 000000000..7779e0e43 --- /dev/null +++ b/common/changes/@visactor/vtable/2749-bug-stack-no-work-in-vtable_2024-11-04-07-44.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: parse axes config error when user set axes #2749\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/packages/vtable/src/layout/chart-helper/get-chart-spec.ts b/packages/vtable/src/layout/chart-helper/get-chart-spec.ts index ba0249342..63ed58af6 100644 --- a/packages/vtable/src/layout/chart-helper/get-chart-spec.ts +++ b/packages/vtable/src/layout/chart-helper/get-chart-spec.ts @@ -170,7 +170,7 @@ export function getChartSpec(col: number, row: number, layout: PivotHeaderLayout export function getChartAxes(col: number, row: number, layout: PivotHeaderLayoutMap): any { const axes = []; if (layout.indicatorsAsCol) { - const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row); + const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row).slice(0, 2); // const colIndex = layout.getRecordIndexByCol(col); const colPath = layout.getColKeysPath(col, row); indicatorKeys.forEach((key, index) => { @@ -225,7 +225,7 @@ export function getChartAxes(col: number, row: number, layout: PivotHeaderLayout // label: { flush: true }, title: { visible: false }, domainLine: { visible: false }, - seriesIndex: index, + seriesIndex: axisOption?.seriesId ? undefined : index, // height: -1, sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs @@ -273,7 +273,7 @@ export function getChartAxes(col: number, row: number, layout: PivotHeaderLayout ) ); } else { - const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row); + const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row).slice(0, 2); const rowPath = layout.getRowKeysPath(col, row); indicatorKeys.forEach((key, index) => { const { range, isZeroAlign, axisOption } = getRange( @@ -328,7 +328,7 @@ export function getChartAxes(col: number, row: number, layout: PivotHeaderLayout // label: { flush: true }, title: { visible: false }, domainLine: { visible: false }, - seriesIndex: index, + seriesIndex: axisOption?.seriesId ? undefined : index, // width: -1, // grid: index === 0 ? undefined : { visible: false }