antvis/G2

【v5】分组柱形和线图组合,线图 series independent 时,tooltip 显示异常 #5273

Deathsteps posted onGitHub

问题描述

错误显示了值而不是,series 的 name(a) <img width="1146" alt="image" src="https://github.com/antvis/G2/assets/1549118/32e01e00-9cce-4f72-a2b3-1248c74b4281">

期望结果

分组柱形图的 tooltip 应该正常显示 series name

如何重现

官方代码修改

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

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

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

chart.data(data);

chart
  .interval()
  .transform({ "type": "dodgeX" })
  .encode('x', 'time')
  .encode('y', 'waiting')
  .encode('color', 'type')
  .axis('y', { title: 'Waiting', style: { titleFill: '#5B8FF9' } });

chart
  .line()
  .encode('x', 'time')
  .encode('y', 'people')
  .encode('shape', 'smooth')
  .encode('color', () => 'people')
  .scale('series', { independent: true });

chart.render();

额外信息

  • G2 5.0.14 版本

这个问题,没人问津一下吗?

posted by Deathsteps over 1 year ago

这个问题已经修复了,升级到最新版本即可。

posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests