antvis / antvis/S2

🐛当多度量且在维度前面时,合计或小计统计无效

Open
#2,776 1 comment 0 reactions 1 assignee Claimed by @lijinke666 View on GitHub
💤 inactive
Dominant language
TypeScript
Stars
1.7k
Forks
220
PR merge metrics
No merged PRs in 30d

Description

### 🏷 Version
官方示例,不论是1.x的版本还是2.0内测版,均有此问题

### Sheet Type

- [x] PivotSheet
- [ ] TableSheet
- [ ] GridAnalysisSheet
- [ ] StrategySheet
- [ ] EditableSheet

### 🖋 Description

首先打开官方示例,这里[附最新地址](https://s2.antv.antgroup.com/examples/analysis/totals/#multiple-values):
具体位置在【分析能力-小计总计-多度量值】(其实什么示例都可以,只是这个示例改动最少代码即可复现)
核心是在 s2DataConfig 中增加 customValueOrder: 0 的配置

让度量在行且在维度前面,如图:
![image](https://github.com/antvis/S2/assets/57079772/8c9e79cb-d228-4800-8987-17e45dbd02e7)
让度量在列且在维度前面,如图:
![image](https://github.com/antvis/S2/assets/57079772/24dc5dd2-82a0-4ff1-b464-3a81552eed1f)

其它情况均正常,只要不设置customValueOrder=0,合计都没问题;如果设置了customValueOrder=0,但只要是单度量也没有问题,下面简单列举两个场景
当度量在行且在维度后面时,无此问题,如图:
![image](https://github.com/antvis/S2/assets/57079772/86c78baf-82b1-4419-93ee-2dc8857c1918)
当度量减少到1个的时候,也无此问题,如图:
![image](https://github.com/antvis/S2/assets/57079772/aa8e6f3c-fcff-4fc1-896c-01952f8a6d19)

### ⌨️ Code Snapshots

fields: {
rows: ['province', 'city'],
columns: ['type'],
valueInCols:false, // 度量在行
customValueOrder: 0, // 度量在维度前面
values: ['price', 'cost'],
},

### 🔗 Reproduce Link

详见:Description

### 🤔 Steps to Reproduce

详见:Description,复现很简单,只需要配置两个属性

### 😊 Expected Behavior

当多度量且度量在维度前时,能正确展示总计信息。可能这里需要设计总计位置,这个只需合理即可,你们可以自主决定。需要注意这里还有个valueInCols配置,两种情况均要能展示合计值

### 😅 Current Behavior

当多度量且度量在维度前时,不论度量是在列还是在行,总计的值均未统计出来

### 💻 System information

| Environment | Info |
| ------- | ------------- |
| System | window 11 |
| Browser | chrome: v125.0 |

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.