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

使用facetCircle绘制时,月份的数据和具体图表对应不上诶 #5624

Closed
1 task done
voiddiddvue opened this issue Oct 10, 2023 · 4 comments
Closed
1 task done
Assignees

Comments

@voiddiddvue
Copy link

voiddiddvue commented Oct 10, 2023

AntV Open Source Contribution Plan(可选)

  • 我同意将这个 Issue 参与 OSCP 计划

Issue 类型

中级任务

任务介绍

使用facetCircle绘制时,月份的数据和具体图表对应不上:

  • 最后绘制出来的图,Jan在Jun那里。
  • 另外,如果month的个数是奇数,就会出现刻度和图表对应不准的情况
import { Chart } from '@antv/g2';

const M = [
  'Jan.',
  'Feb.',
  'Mar.',
  'Apr.',
  'May',
  'Jun.',
  'Jul.',
  'Aug.',
  'Sept.',
  'Oct.',
  'Nov.',
  'Dec.',
];
const N = ['A', 'B', 'C', 'D'];
const data = M.flatMap((month) =>
  N.map((name) => ({
    month,
    name,
    value: month === 'Jan.' ? 1 : 0 //这里指定数据
  })),
);

const chart = new Chart({
  container: 'container',
  width: 480,
  height: 480,
});

const facetCircle = chart.facetCircle().data(data).encode('position', 'month');

facetCircle
  .interval()
  .encode('x', 'name')
  .encode('y', 'value')
  .encode('color', 'name');

chart.render();

参考

  • 可能和这个函数有关系。
@pearmini
Copy link
Member

这个感觉是个 bug,和这个函数有关系,感兴趣来修复一下吗?

@voiddiddvue
Copy link
Author

这个感觉是个 bug,和这个函数有关系,感兴趣来修复一下吗?

好,有空了看看我能不能修复

@BENcorry
Copy link
Contributor

BENcorry commented Nov 16, 2023

【BENcorry 认领】
没人的话我领拉哈

@pearmini
Copy link
Member

closed by:#5833

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

No branches or pull requests

3 participants