Skip to content

【V5】Tooltip title 设置常量不生效 #5299

Answered by pearmini
BinghuiXie asked this question in Q&A
Discussion options

You must be logged in to vote

目前可以通过 valueFormatter 实现该需求:

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

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

chart
  .interval()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/fb9db6b7-23a5-4c23-bbef-c54a55fee580.csv',
  })
  .encode('x', 'letter')
  .encode('y', 'frequency')
  .axis('y', { labelFormatter: '.0%' })
  .tooltip({
    title: { valueFormatter: () => '123' } // 这里
  })

chart.render();

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@pearmini
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pearmini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #5297 on July 12, 2023 03:38.