VisActor / VisActor/VTable

[Bug] 配置subTotalsDimensions为[]或少于行维度总数-1 时,折叠行时指标列什么都不显示,而展开后正常显示

Open
#4,221 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
486
Avg merge
1d 19h
Merged PRs (30d)
16

Description

Version

v1.18.1

Link to Minimal Reproduction

subTotalsDimensions + rowHierarchyType = grid-tree

Steps to Reproduce

配置代码如下:
let tableInstance;
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_Pivot_Chart_data.json')
.then(res => res.json())
.then(data => {
const option = {
records: data,
rows: [
{
dimensionKey: 'Category',
title: 'Category',
headerStyle: {
textStick: true
},
width: 'auto'
},
{
dimensionKey: 'Sub-Category',
title: 'Sub-Catogery',
headerStyle: {
textStick: true
},
width: 'auto'
}
],
indicators: [
{
indicatorKey: 'Quantity',
title: 'Quantity',
width: 'auto',
showSort: false,
headerStyle: {
fontWeight: 'normal'
},
style: {
padding: [16, 28, 16, 28],
color(args) {
if (args.dataValue >= 0) return 'black';
return 'red';
},
bgColor(arg) {
const rowHeaderPaths = arg.cellHeaderPaths.rowHeaderPaths;
if (rowHeaderPaths?.[1]?.value === 'Sub Totals') {
return '#ba54ba';
} else if (rowHeaderPaths?.[0]?.value === 'Row Totals') {
return '#ff9900';
}
return undefined;
}
}
},
{
indicatorKey: 'Sales',
title: 'Sales',
width: 'auto',
showSort: false,
headerStyle: {
fontWeight: 'normal'
},
style: {
padding: [16, 28, 16, 28],
color(args) {
if (args.dataValue >= 0) return 'black';
return 'red';
},
bgColor(arg) {
const rowHeaderPaths = arg.cellHeaderPaths.rowHeaderPaths;
if (rowHeaderPaths?.[1]?.value === 'Sub Totals') {
return '#ba54ba';
} else if (rowHeaderPaths?.[0]?.value === 'Row Totals') {
return '#ff9900';
}
return undefined;
}
}
},
{
indicatorKey: 'Profit',
title: 'Profit',
width: 'auto',
showSort: false,
headerStyle: {
fontWeight: 'normal'
},
style: {
padding: [16, 28, 16, 28],
color(args) {
if (args.dataValue >= 0) return 'black';
return 'red';
},
bgColor(arg) {
const rowHeaderPaths = arg.cellHeaderPaths.rowHeaderPaths;
if (rowHeaderPaths?.[1]?.value === 'Sub Totals') {
return '#ba54ba';
} else if (rowHeaderPaths?.[0]?.value === 'Row Totals') {
return '#ff9900';
}
return undefined;
}
}
}
],
corner: {
titleOnDimension: 'row',
headerStyle: {
textStick: true
}
},
dataConfig: {
totals: {
row: {
showGrandTotals: true,
showSubTotals: true,
subTotalsDimensions: [],
grandTotalLabel: 'Row Totals',
subTotalLabel: 'Sub Totals',
},
}
},
widthMode: 'standard',
rowHierarchyType: 'grid-tree'
};
tableInstance = new VTable.PivotTable(document.getElementById(CONTAINER_ID), option);
window['tableInstance'] = tableInstance;
});
以上是一个没有列维度的交叉表,如果subTotalsDimensions数组长度=当前所有行维度总数-1时是正常展示的;但subTotalsDimensions为空或者比当前行维度总数-1少的情况下,指标列收起时什么都不展示,而展开后就正常展示了;

Current Behavior
Image Image
Expected Behavior

期望收起时也可以正常展示数据

Environment
- OS:
- Browser:
- Framework:
Any additional comments?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the VTable.PivotTable entry point and reproduce the grid-tree case using the provided North American Superstore data and subTotalsDimensions: []. Compare collapsed and expanded indicator rendering, then trace the row-total configuration. Done means indicators remain visible when rows are collapsed, including when subTotalsDimensions is empty or shorter than the row-dimension count minus one.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.