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

feat(tooltip): disableNative #5236

Merged
merged 1 commit into from
Jun 27, 2023
Merged

feat(tooltip): disableNative #5236

merged 1 commit into from
Jun 27, 2023

Conversation

pearmini
Copy link
Member

@pearmini pearmini commented Jun 27, 2023

DisableNative

Tooltip 交互通过 disableNative 来屏蔽原生的事件,可以实现点击出现 tooltip 的效果。

开始使用

tooltip-click

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%' })
  .interaction('tooltip', { disableNative: true }); // Disable pointerover and pointerout events.

chart.on('element:click', ({ data }) => chart.emit('tooltip:show', { data }));

chart.on('plot:click', () => chart.emit('tooltip:hide'));

chart.render();

@pearmini pearmini requested a review from hustcc June 27, 2023 02:59
@pearmini pearmini merged commit 70d847f into v5 Jun 27, 2023
@pearmini pearmini deleted the tooltip-disable branch June 27, 2023 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants