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

在v2.0.0-next.15和v2.0.0-next.16中透视表使用小计总计时总计不能计算出 #2621

Closed
yongkangzhang opened this issue Mar 23, 2024 · 4 comments
Labels
🐛 bug 这个是一个 bug next 2.0-next 版本的问题

Comments

@yongkangzhang
Copy link

在使用v2.0.0-next.15和v2.0.0-next.16版本:

小计总计不能完全统计,显示不全,使用框架是vue3

如图:

v2.0.0-next.15和v2.0.0-next.16版本:

2 0 0

v1.54.7版本

image

代码

代码相同只是版本不同

<template>
    <div id="container"/>
</template>

<script setup lang="ts">
import {PivotSheet} from "@antv/s2";
import { onMounted } from 'vue';

const bootstrap = async () => {
    const data = [
        {
            "province": "浙江",
            "city": "杭州",
            "type": "笔",
            "price": "1"
        },
        {
            "province": "浙江",
            "city": "杭州",
            "type": "纸张",
            "price": "2"
        },
        {
            "province": "浙江",
            "city": "舟山",
            "type": "笔",
            "price": "17"
        },
        {
            "province": "浙江",
            "city": "舟山",
            "type": "纸张",
            "price": "6"
        },
        {
            "province": "吉林",
            "city": "长春",
            "type": "笔",
            "price": "8"
        },
        {
            "province": "吉林",
            "city": "白山",
            "type": "笔",
            "price": "12"
        },
        {
            "province": "吉林",
            "city": "长春",
            "type": "纸张",
            "price": "3"
        },
        {
            "province": "吉林",
            "city": "白山",
            "type": "纸张",
            "price": "25"
        },
        {
            "province": "吉林",
            "city": "白山",
            "type": "纸张",
            "price": "10"
        },
        {
            "province": "浙江",
            "city": "杭州",
            "type": "笔",
            "cost": "0.5"
        },
        {
            "province": "浙江",
            "city": "杭州",
            "type": "纸张",
            "cost": "20"
        },
        {
            "province": "浙江",
            "city": "舟山",
            "type": "笔",
            "cost": "1.7"
        },
        {
            "province": "浙江",
            "city": "舟山",
            "type": "纸张",
            "cost": "0.12"
        },
        {
            "province": "吉林",
            "city": "长春",
            "type": "笔",
            "cost": "10"
        },
        {
            "province": "吉林",
            "city": "白山",
            "type": "笔",
            "cost": "9"
        },
        {
            "province": "吉林",
            "city": "长春",
            "type": "纸张",
            "cost": "3"
        },
        {
            "province": "吉林",
            "city": "白山",
            "type": "纸张",
            "cost": "1"
        }
    ];

    // 配置数据
    const s2DataConfig = {
        fields: {
            rows: ['province', 'city'],
            columns: ['type'],
            values: ['price'],
        },
        meta: [
            {
                field: 'province',
                name: '省份',
            },
            {
                field: 'city',
                name: '城市',
            },
            {
                field: 'type',
                name: '商品类别',
            },
            {
                field: 'price',
                name: '价格',
            },
        ],
        data,
    };
    // 添加配置
    const s2Options = {
        width: 600,
        height: 480,
        // 配置小计总计显示
        totals: {
            row: {
                showGrandTotals: true,
                showSubTotals: true,
                reverseLayout: true,
                reverseSubLayout: true,
                subTotalsDimensions: ['province'],
                calcTotals: {
                    aggregation: 'SUM',
                },
                calcSubTotals: {
                    aggregation: 'SUM',
                },
            },
            col: {
                showGrandTotals: true,
                showSubTotals: true,
                reverseLayout: true,
                reverseSubLayout: true,
                subTotalsDimensions: ['type'],
                calcTotals: {
                    aggregation: 'SUM',
                },
                calcSubTotals: {
                    aggregation: 'SUM',
                },
            },
        },
    };

    const container = document.getElementById('container');
    const s2 = new PivotSheet(container, s2DataConfig, s2Options);
    await s2.render();
}

onMounted(() => {
    bootstrap();
})
</script>

依赖

v1.54.7

  "dependencies": {
    "@antv/s2": "^1.54.7",
    "axios": "^1.6.8",
    "vue": "^3.4.21",
    "vue-router": "^4.3.0"
  },

v2.0.0-next.15和v2.0.0-next.16

  "dependencies": {
    "@antv/s2": "^v2.0.0-next.16",
    "axios": "^1.6.8",
    "vue": "^3.4.21",
    "vue-router": "^4.3.0"
  },
Copy link
Contributor

你好 @yongkangzhang,请按照 issue 模板填写相关信息, 方便大家高效沟通, 强烈推荐你阅读 提 Issue 前必读如何向开源项目提交无法解答的问题

Hello @yongkangzhang, please fill in the relevant information according to the issue template to facilitate communication efficiently. recommend you to read 提 Issue 前必读 and 如何向开源项目提交无法解答的问题, Thanks so much!

@github-actions github-actions bot added the ⛔ invalid issue 什么描述都没写 label Mar 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2024
@wjgogogo wjgogogo reopened this Mar 25, 2024
@wjgogogo wjgogogo added 🐛 bug 这个是一个 bug and removed ⛔ invalid issue 什么描述都没写 labels Mar 25, 2024
Copy link
Contributor

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

Hello, @yongkangzhang, 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
Copy link
Contributor

next中总计的配置是calcGrandTotals, 而不是配置中的calcTotals

@lijinke666 lijinke666 added the next 2.0-next 版本的问题 label Apr 30, 2024
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 版本的问题
Projects
None yet
Development

No branches or pull requests

3 participants