antvis / antvis/S2

🐛 customValueOrder=0时,多个数值列的总计列头被合并到一起了

Open
#3,215 6 comments 0 reactions 0 assignees View on GitHub
💤 inactive
Dominant language
TypeScript
Stars
1.7k
Forks
220
PR merge metrics
No merged PRs in 30d

Description

### 🏷 S2 Version / S2 版本

| Package | Version |
| -------------- | ------- |
| @antv/s2 | 2.4.6 |
| @antv/s2-react | |
| @antv/s2-react-components | |

### 💻 Sheet Type / 表格类型

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

### 🖋 Describe the bug / 问题描述

customValueOrder=0时,多个数值列的总计表头被合并到一起了。

Image

Image

期待效果
Image

### ⌨️ Code Snapshots / 代码片段

```js

import { PivotSheet, S2DataConfig, S2Options } from '@antv/s2';
const container = document.getElementById('container');
const s2DataConfig: S2DataConfig = {
fields: {
rows: ['province', 'city'],
columns: ['type', 'sub_type'],
values: ['number', 'price'],
valueInCols: true,
// 自定义指标属性层级顺序, 即 fields.values 的顺序 (从 0 开始)
customValueOrder: 0,
},
data: [
{
"number": 7789,
"province": "浙江省",
"city": "杭州市",
"type": "家具",
"sub_type": "桌子",
"price": 1899
},
],
meta: [
{
field: 'number',
name: '数量',
},
{
field: "price",
name: "价格",
},
{
field: 'province',
name: '省份',
},
{
field: 'city',
name: '城市',
},
{
field: 'type',
name: '类别',
},
{
field: 'sub_type',
name: '子类别',
},
],
};

const s2Options: S2Options = {
width: 600,
height: 480,
cornerExtraFieldText: "度量",
totals: {
col: {
showGrandTotals: true,
showSubTotals: true,
reverseGrandTotalsLayout: true,
reverseSubTotalsLayout: true,

},
row: {
reverseGrandTotalsLayout: true,
reverseSubTotalsLayout: true,
showGrandTotals: true,
showSubTotals: true,
subTotalsDimensions: ['price'],
}
}
};

const s2 = new PivotSheet(container, s2DataConfig, s2Options);

s2.render();

```

### 🔗 Reproduction link / 复现链接

https://s2.antv.antgroup.com/examples/custom/custom-layout/#custom-value-order

### 📋 Steps to Reproduce the Bug or Issue / 重现步骤

将上面代码粘贴到链接到demo里,调整customValueOrder值为0

### 😊 Expected Behavior / 期望行为

Image

### 😅 Current Behavior / 当前行为

_No response_

### 💻 OS / 操作系统

- [x] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他

### 🌏 Browser / 浏览器

- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

Open the contributing guide

Research direction

Use the linked custom-layout example as the reproduction entry point and run the PivotSheet configuration with values ['number', 'price'] and customValueOrder set to 0. Trace how the column totals headers are produced when both row and column totals are enabled. Done means the total headers remain separate for the multiple value columns and match the expected screenshot.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.