diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts index 4d30fdca5b..a458af895c 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts @@ -147,18 +147,15 @@ export class TableInfo extends S2ChartView { } // 开启序号之后,第一列就是序号列,修改 label 即可 if (s2Options.showSeriesNumber) { - s2Options.colCell = (node, sheet, config) => { - if (node.colIndex === 0) { - let indexLabel = customAttr.tableHeader.indexLabel - if (!indexLabel) { - indexLabel = '' - } - const cell = new TableColCell(node, sheet, config) - const shape = cell.getTextShape() as any - shape.attrs.text = indexLabel - return cell + let indexLabel = customAttr.tableHeader.indexLabel + if (!indexLabel) { + indexLabel = '' + } + s2Options.layoutCoordinate = (_, __, col) => { + if (col.colIndex === 0 && col.rowIndex === 0) { + col.label = indexLabel + col.value = indexLabel } - return new TableColCell(node, sheet, config) } } s2Options.dataCell = viewMeta => { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts index 2509fcee7e..2ad3fde3ae 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-normal.ts @@ -135,21 +135,15 @@ export class TableNormal extends S2ChartView { } // 开启序号之后,第一列就是序号列,修改 label 即可 if (s2Options.showSeriesNumber) { - s2Options.colCell = (node, sheet, config) => { - if (node.colIndex === 0) { - let indexLabel = customAttr.tableHeader.indexLabel - if (!indexLabel) { - indexLabel = '' - } - const cell = new TableColCell(node, sheet, config) - const shape = cell.getTextShape() as any - shape.attrs.text = indexLabel - return cell - } - return new TableColCell(node, sheet, config) + let indexLabel = customAttr.tableHeader.indexLabel + if (!indexLabel) { + indexLabel = '' } - s2Options.dataCell = viewMeta => { - return new TableDataCell(viewMeta, viewMeta?.spreadsheet) + s2Options.layoutCoordinate = (_, __, col) => { + if (col.colIndex === 0 && col.rowIndex === 0) { + col.label = indexLabel + col.value = indexLabel + } } } // tooltip diff --git a/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts b/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts index 00fc52bc77..dc0fa85078 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/types/impl/s2.ts @@ -83,10 +83,6 @@ export abstract class S2ChartView

extends AntVAbstractCha break case 'rowCell': case 'colCell': - if (meta.field === SERIES_NUMBER_FIELD) { - content = cell.getTextShape()['attrs'].text - break - } content = meta.label field = find(metaConfig, item => item.field === content) if (field) {