Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤔透视表 是否支持行头的合并? #2386

Closed
platozzZ opened this issue Oct 25, 2023 · 1 comment
Closed

🤔透视表 是否支持行头的合并? #2386

platozzZ opened this issue Oct 25, 2023 · 1 comment

Comments

@platozzZ
Copy link

🏷 Version

Package Version
@antv/s2 ^1.51.1
@antv/s2-react ^1.44.0

🖋 Description

如下图所示:

  1. 行头是否支持 省份和城市的单元格合并呢?(如北京市这一行,两个北京市就显得冗余了)
  2. 如果同个省份下面只有一条数据,小计这一行是否可以作为配置项隐藏掉呢?

image

@lijinke666
Copy link
Member

行头是否支持 省份和城市的单元格合并呢?(如北京市这一行,两个北京市就显得冗余了)

怎么展示完全取决你的数据, 对于这种直辖市, 省份建议处理成 "北京/天津" 而不是 "北京市/天津市"

如果同个省份下面只有一条数据,小计这一行是否可以作为配置项隐藏掉呢?

可以通过 layoutHierarchy 自定义层级结构

const s2Options = {
  layoutHierarchy: (s2, node) => {
    // 是小计, 并且只有一个子节点, 就移除自己
    if (node.isSubTotals && node.parent.children.length === 1) {
      return {
        push: [],
        unshift: [],
        delete: true,
      };
    }
    return null;
  },
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants