feat(图表): 汇总表总计行和数据行之间不留白 #12243

This commit is contained in:
wisonic 2024-09-27 19:25:49 +08:00
parent af4d253273
commit 82de4ee36c

View File

@ -209,6 +209,19 @@ export class TableNormal extends S2ChartView<TableSheet> {
}
// 开始渲染
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, () => {