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 5171b8aae8..a5fbcf4053 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 @@ -209,6 +209,19 @@ export class TableNormal extends S2ChartView { } // 开始渲染 const newChart = new TableSheet(containerDom, s2DataConfig, s2Options) + // 总计紧贴在单元格后面 + if (customAttr.basicStyle.showSummary) { + newChart.on(S2Event.LAYOUT_BEFORE_RENDER, () => { + const totalHeight = + customAttr.tableHeader.tableTitleHeight * 2 + + customAttr.tableCell.tableItemHeight * (newData.length - 1) + if (totalHeight < newChart.options.height) { + // 6 是阴影高度 + newChart.options.height = + totalHeight < newChart.options.height - 6 ? totalHeight + 6 : totalHeight + } + }) + } // 自适应铺满 if (customAttr.basicStyle.tableColumnMode === 'adapt') { newChart.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, () => {