Skip to content

Commit

Permalink
fix: fix row level in getCellAdressByHeaderPath()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Mar 19, 2024
1 parent b96335f commit 97c3d07
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vtable",
"comment": "fix: fix row level in getCellAdressByHeaderPath()",
"type": "none"
}
],
"packageName": "@visactor/vtable"
}
13 changes: 3 additions & 10 deletions packages/vtable/examples/debug/aeolus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2561,21 +2561,14 @@ export function createTable() {
// document.getElementById(CONTAINER_ID).parentElement.style.display = 'none';
const instance = new VTable.PivotChart(document.getElementById(CONTAINER_ID), option);
window.tableInstance = instance;
setTimeout(() => {
document.getElementById(CONTAINER_ID).parentElement.style.display = 'none';
}, 1000);

setTimeout(() => {
document.getElementById(CONTAINER_ID).parentElement.style.display = 'block';
}, 3000);

// tableInstance.onVChartEvent('mouseover', args => {
// console.log('listenChart mouseover', args);
// });

// bindDebugTool(tableInstance.scenegraph.stage, {
// customGrapicKeys: ['col', 'row']
// });
bindDebugTool(tableInstance.scenegraph.stage, {
customGrapicKeys: ['col', 'row']
});

window.update = () => {
(option.rowTree = [
Expand Down
4 changes: 3 additions & 1 deletion packages/vtable/src/layout/pivot-header-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
if (node.children?.length) {
supplyAxisNode(node.children);
} else {
// 在指标在列上的透视图中,主指标轴(离散轴)显示在左侧,因此需要在原先行表头的布局中最右侧加入一列,用来显示坐标轴
// 加入的这一列dimensionKey配置为'axis',在后续行列计算维度时需要注意,这一列是为了显示坐标轴加入的,不在行列维度信息内
node.children = [
{
dimensionKey: 'axis',
Expand Down Expand Up @@ -2292,7 +2294,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
(!rowDimension.value || dimension.value === rowDimension.value))
) {
rowArr = dimension.children;
if (needLowestLevel && !rowArr) {
if (needLowestLevel && (!rowArr || rowArr.some(row => row.dimensionKey === 'axis'))) {
rowDimensionFinded = dimension;
} else if (!needLowestLevel) {
rowDimensionFinded = dimension;
Expand Down

0 comments on commit 97c3d07

Please sign in to comment.