antvis/G2

Do you want to work on this issue?

You can request for a bounty in order to promote it!

堆叠图缺失数据,切换图例,导致柱状图显示错误 #6343

sexxOyxin posted onGitHub

问题描述

删除一、二月数据后,点击图例展示单项值后再堆叠展示,会出现数据往前移的效果。

刚发现如果过很久不操作以后,又会正常显示了。

重现链接

https://g2.antv.antgroup.com/examples/general/interval/#bar-basic-stacked

重现步骤

No response

预期行为

No response

平台

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

屏幕截图或视频(可选)

image

补充说明(可选)

我在本地项目中绘制了堆叠图+折线图,当堆叠图只有一个月份(十二月)数据时,x轴月份轴会从十二月开始,导致折线图错乱。

参考以前issue,加了.scale("y", { 'type': 'linear' })并未解决问题。


暂时的解决方案是把缺失字段补 0:

const data = [
  { name: 'London', 月份: 'Jan.', 月均降雨量: 18.9 },
  { name: 'London', 月份: 'Feb.', 月均降雨量: 28.8 },
  { name: 'London', 月份: 'Mar.', 月均降雨量: 39.3 },
  { name: 'London', 月份: 'Apr.', 月均降雨量: 81.4 },
  { name: 'London', 月份: 'May', 月均降雨量: 47 },
  { name: 'London', 月份: 'Jun.', 月均降雨量: 20.3 },
  { name: 'London', 月份: 'Jul.', 月均降雨量: 24 },
  { name: 'London', 月份: 'Aug.', 月均降雨量: 35.6 },
  { name: 'Berlin', 月份: 'Jan.', 月均降雨量: 0 }, // 补 0
  { name: 'Berlin', 月份: 'Feb.', 月均降雨量: 0 }, // 补 0
  { name: 'Berlin', 月份: 'Mar.', 月均降雨量: 34.5 },
  { name: 'Berlin', 月份: 'Apr.', 月均降雨量: 99.7 },
  { name: 'Berlin', 月份: 'May', 月均降雨量: 52.6 },
  { name: 'Berlin', 月份: 'Jun.', 月均降雨量: 35.5 },
  { name: 'Berlin', 月份: 'Jul.', 月均降雨量: 37.4 },
  { name: 'Berlin', 月份: 'Aug.', 月均降雨量: 42.4 },
];

进一步的问题需要排查看看。

posted by pearmini 10 months ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests