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

柱状图不对齐 #5957

Closed
YY88Xu opened this issue Dec 20, 2023 · 1 comment
Closed

柱状图不对齐 #5957

YY88Xu opened this issue Dec 20, 2023 · 1 comment

Comments

@YY88Xu
Copy link

YY88Xu commented Dec 20, 2023

问题描述

image
import { Chart } from '@antv/g2';

const data = [
    {
        "Date":"2023年10月",
        "value":1716,
        key: 'TotalHc'
    },
    {
        "Date":"2023年10月",
        "value":5496,
        key: 'TotalHc'
    },
    {
        "Date":"2023年10月",
        "value":5496,
        key: 'CurrentHc'
    },
    {
        "Date":"2023年10月",
        "value":320,
        key: 'HcPercent'
    },
]

const chart = new Chart({
  container: 'container',
  autoFit: true,
});

chart.data(data)

chart.interval()
.encode('x', 'Date')
.encode('y', 'value')
.encode('color', 'key')
.transform({ type: 'dodgeX' })


chart.interaction('elementHighlight', { background: true })

chart.render();

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@pearmini
Copy link
Member

pearmini commented Dec 21, 2023

每一组里面的 key 必须是唯一的,但数据里面有两个 TotalHC

@hustcc hustcc closed this as completed Dec 26, 2023
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

3 participants