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

Tooltip 交互自定义报错 #4552

Closed
pearmini opened this issue Jan 6, 2023 · 0 comments · Fixed by #4558
Closed

Tooltip 交互自定义报错 #4552

pearmini opened this issue Jan 6, 2023 · 0 comments · Fixed by #4558
Assignees
Labels
Milestone

Comments

@pearmini
Copy link
Member

pearmini commented Jan 6, 2023

Tool 交互自定义报错

  • 版本:5.0.0-beta.5

image

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

const chart = new Chart({
  container: 'container',
  paddingLeft: 50,
});

chart
  .line()
  .data({
    type: 'fetch',
    value: 'https://assets.antv.antgroup.com/g2/indices.json',
  })
  .transform({ type: 'normalizeY', basis: 'first', groupBy: 'color' })
  .encode('x', (d) => new Date(d.Date))
  .encode('y', 'Close')
  .encode('color', 'Symbol')
  .encode('title', (d) => d.Date.toLocaleString())
  .axis('y', { title: '↑ Change in price (%)' })
  .label({
    text: 'Symbol',
    selector: 'last',
    fontSize: 10,
  });

chart.interaction({
  type: 'tooltip',
  item: ({ value }) => ({ value: value.toFixed(1) }),
});

chart.render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant