antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.08k stars 1.58k forks source link

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

Closed voiddiddvue closed 9 months ago

voiddiddvue commented 11 months ago

AntV Open Source Contribution Plan(可选)

Issue 类型

中级任务

任务介绍

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

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 commented 11 months ago

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

voiddiddvue commented 11 months ago

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

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

BENcorry commented 9 months ago

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

pearmini commented 9 months ago

closed by:https://github.com/antvis/G2/pull/5833