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

🐛交叉表只有列维度时,同时开启行总计和列总计,复制的数据中行总计的值与表格实际渲染的值不符 #2928

Closed
1 of 5 tasks
KzqKzq opened this issue Oct 16, 2024 · 2 comments · Fixed by #2937
Assignees
Labels
🐛 bug 这个是一个 bug next 2.0-next 版本的问题 released on @next

Comments

@KzqKzq
Copy link

KzqKzq commented Oct 16, 2024

🏷 Version

Package Version
@antv/s2
@antv/s2-react
@antv/s2-vue

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

交叉表只有列维度时,同时开启行总计(均值)和列总计(求和),调用asyncGetAllPlainData 函数得到的复制数据里面行总计的值与表格实际渲染的值不符

⌨️ Code Snapshots

直接使用官网示例在线演示 链接,替换成下面代码

// organize-imports-ignore
import React from 'react';
import { Aggregation, S2DataConfig } from '@antv/s2';
import { SheetComponent, SheetComponentOptions } from '@antv/s2-react';
import '@antv/s2-react/dist/style.min.css';

fetch(
  'https://gw.alipayobjects.com/os/bmw-prod/cd9814d0-6dfa-42a6-8455-5a6bd0ff93ca.json',
)
  .then((res) => res.json())
  .then((res) => {
    const s2Options: SheetComponentOptions = {
      width: 600,
      height: 480,
      interaction: {
        copy: { enable: true },
      },
      totals: {
        col: {
          showGrandTotals: true,
          showSubTotals: true,
          reverseGrandTotalsLayout: true,
          calcGrandTotals: {
            // 设置总计汇总计算方式为求和
            aggregation: Aggregation.SUM,
          },
        },
        row: {
          showGrandTotals: true,
          calcGrandTotals: {
            // 设置总计汇总计算方式为均值
            aggregation: Aggregation.AVG,
          },
        },
      },
    };

    const s2DataConfig: S2DataConfig = {
      fields: {
        rows: ['province', 'city'],
        // columns: ['type', 'sub_type'],
        values: ['number'],
      },
      meta: res.meta,
      data: res.data,
    };

    reactDOMClient.createRoot(document.getElementById('container')).render(
      <SheetComponent
        dataCfg={s2DataConfig}
        options={s2Options}
        header={{
          export: {
            open: true,
          },
        }}
        adaptive={false}
      />,
    );
  });

🔗 Reproduce Link

🤔 Steps to Reproduce

点击react 组件的任意一个复制按钮
image

😊 Expected Behavior

希望表格显示的行总计与复制的行总计值一致

😅 Current Behavior

可以看到表格显示的行总计与复制的行总计值不一致
image

💻 System information

Environment Info
System window 10
Browser chrome: v128.0.6613.86
@github-actions github-actions bot added the next 2.0-next 版本的问题 label Oct 16, 2024
@lijinke666 lijinke666 self-assigned this Oct 23, 2024
@lijinke666 lijinke666 added the 🐛 bug 这个是一个 bug label Oct 23, 2024
Copy link
Contributor

你好 @KzqKzq,很抱歉给你带来了不好的体验, 我们会尽快排查问题并修复, 请关注后续发布日志.

Hello, @KzqKzq, We are so sorry for the bad experience. We will troubleshoot and fix the problem as soon as possible. Please pay attention to the follow-up change logs.

wjgogogo pushed a commit that referenced this issue Oct 25, 2024
* fix: 修复自定义计算总计时, 复制的数据不正确 close #2928

* test: 更新单测
@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-v2.0.0-next.30 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug 这个是一个 bug next 2.0-next 版本的问题 released on @next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants