fix: when chart row is frozen render error #2800

This commit is contained in:
fangsmile 2024-11-12 17:27:54 +08:00
parent aaa03b6351
commit e33b07e379
3 changed files with 32 additions and 12 deletions

View File

@ -1347,14 +1347,20 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
}
return false;
}
isLeftTopCorner(col: number, row: number): boolean {
if (col >= 0 && col < this.frozenColCount && row >= 0 && row < this.frozenRowCount) {
return true;
}
return false;
}
isLeftBottomCorner(col: number, row: number): boolean {
if (col >= 0 && col < this.rowHeaderLevelCount && row >= this.rowCount - this.bottomFrozenRowCount) {
if (col >= 0 && col < this.frozenColCount && row >= this.rowCount - this.bottomFrozenRowCount) {
return true;
}
return false;
}
isRightTopCorner(col: number, row: number): boolean {
if (col >= this.colCount - this.rightFrozenColCount && row >= 0 && row < this.columnHeaderLevelCount) {
if (col >= this.colCount - this.rightFrozenColCount && row >= 0 && row < this.frozenRowCount) {
return true;
}
return false;

View File

@ -594,14 +594,20 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI {
}
return false;
}
isLeftTopCorner(col: number, row: number): boolean {
if (col >= 0 && col < this.frozenColCount && row >= 0 && row < this.frozenRowCount) {
return true;
}
return false;
}
isLeftBottomCorner(col: number, row: number): boolean {
if (col >= 0 && col < this.rowHeaderLevelCount && row >= this.rowCount - this.bottomFrozenRowCount) {
if (col >= 0 && col < this.frozenColCount && row >= this.rowCount - this.bottomFrozenRowCount) {
return true;
}
return false;
}
isRightTopCorner(col: number, row: number): boolean {
if (col >= this.colCount - this.rightFrozenColCount && row >= 0 && row < this.columnHeaderLevelCount) {
if (col >= this.colCount - this.rightFrozenColCount && row >= 0 && row < this.frozenRowCount) {
return true;
}
return false;

View File

@ -250,19 +250,21 @@ function getTableBounds(col: number, row: number, table: BaseTableAPI) {
bodyBound.x2 = tableBound.x2;
bodyBound.y1 = tableBound.y1;
bodyBound.y2 = tableBound.y2;
if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
// no frozen body
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
} else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) {
if (
layoutMap.isLeftBottomCorner(col, row) ||
layoutMap.isRightTopCorner(col, row) ||
layoutMap.isLeftTopCorner(col, row) ||
layoutMap.isRightBottomCorner(col, row)
) {
// frozen cornor
} else if (layoutMap.isFrozenColumn(col, row)) {
// left frozen
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
} else if (layoutMap.isFrozenRow(col, row)) {
// top frozen
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
} else if (layoutMap.isRightFrozenColumn(col, row)) {
// right frozen
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
@ -271,6 +273,12 @@ function getTableBounds(col: number, row: number, table: BaseTableAPI) {
// bottom frozen
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
} else if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
// no frozen body
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
}
bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);