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

【v5】scale key, style cursor, elementHighlightByColor 互斥问题 #5535

Closed
Deathsteps opened this issue Sep 12, 2023 · 1 comment · Fixed by #5815
Closed

【v5】scale key, style cursor, elementHighlightByColor 互斥问题 #5535

Deathsteps opened this issue Sep 12, 2023 · 1 comment · Fixed by #5815
Labels
Milestone

Comments

@Deathsteps
Copy link
Contributor

问题描述

  1. 同时配置 scale("y", { "key": "main" })elementHighlightByColor background true,图形 hover 崩溃(在用的 5.0.16 版本无此问题,5.1.1 版本出现)
  2. 同时配置 scale("y", { "key": "main" }) elementHighlightByColor background true style cursor,在用的 5.0.16 版本,style cursor 不生效

期望结果

期望正常显示不冲突(实在难受:cry:)

如何重现

官方代码修改

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

const data = [
  { time: '10:10', call: 4, waiting: 2, people: 2 },
  { time: '10:15', call: 2, waiting: 6, people: 3 },
  { time: '10:20', call: 13, waiting: 2, people: 5 },
  { time: '10:25', call: 9, waiting: 9, people: 1 },
  { time: '10:30', call: 5, waiting: 2, people: 3 },
  { time: '10:35', call: 8, waiting: 2, people: 1 },
  { time: '10:40', call: 13, waiting: 1, people: 2 },
];

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

chart.data(data);

chart
  .interval()
  .encode('x', 'time')
  .encode('y', 'people')
  .encode('size', 30)
  .style('cursor', 'pointer')
  .scale("y", { "key": "main" })
  .axis('y', { title: 'Waiting', titleFill: '#5B8FF9' });

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

chart.render();

额外信息

  • G2 5.1.1 版本
  • G2 5.0.16
@pearmini
Copy link
Member

应该是在 elementHighlightByColor 绘制背景的使用用了 band 比例尺,然后 band.getBandWidth() 报错了。

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

Successfully merging a pull request may close this issue.

2 participants