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 render to mount dom #5025

Merged
merged 3 commits into from
May 16, 2023
Merged

feat: tooltip render to mount dom #5025

merged 3 commits into from
May 16, 2023

Conversation

hustcc
Copy link
Member

@hustcc hustcc commented May 15, 2023

fixed #5024

  • add mount config to tooltip interaction
  • refactor tooltip component
  • tests
  • documents
{
  width: 600,
  height: 400,
  type: 'view',
  data: {
    type: 'fetch',
    value: 'data/aapl.csv',
  },
  children: [
    {
      type: 'area',
      encode: {
        x: 'date',
        y: 'close',
      },
      transform: [
        {
          type: 'sample',
          thresholds: 100,
          strategy: 'lttb',
        },
      ],
      style: {
        fillOpacity: 0.5,
      },
      tooltip: {
        title: (d) => new Date(d.date).toUTCString(),
      },
      interaction: {
        tooltip: {
          mount: 'body',
          bounding: {
            x: 100,
            y: 100,
            width: 500,
            height: 300,
          },
        },
      },
    },
  ],
}

@hustcc hustcc requested review from pearmini and Aarebecca May 15, 2023 10:51
@hustcc
Copy link
Member Author

hustcc commented May 15, 2023

另外,tooltip 的 classname 目前是 .tooltip 不具备标识性,改成和 4.x 一致的 .g2-tooltip

Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__tests__/integration/snapshots/tooltip/aapl-line-area-basic-sample-mount/step0.html 这个截图为啥没有内容?

@hustcc
Copy link
Member Author

hustcc commented May 15, 2023

__tests__/integration/snapshots/tooltip/aapl-line-area-basic-sample-mount/step0.html 这个截图为啥没有内容?

已修复。

@hustcc
Copy link
Member Author

hustcc commented May 15, 2023

另外,tooltip 的 classname 目前是 .tooltip 不具备标识性,改成和 4.x 一致的 .g2-tooltip

下一个 pr 统一改,减少 cr 难度。

@hustcc hustcc requested a review from pearmini May 15, 2023 12:24
@pearmini pearmini merged commit c893c28 into v5 May 16, 2023
@pearmini pearmini deleted the feat-tooltip-render-to-mount branch May 16, 2023 01:44
hustcc added a commit that referenced this pull request May 16, 2023
* feat: tooltip render to mount dom

* fix: append canvas into jsdom

* docs: update interaction.tooltip documents
hustcc added a commit that referenced this pull request May 16, 2023
* feat: tooltip render to mount dom

* fix: append canvas into jsdom

* docs: update interaction.tooltip documents
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.

tooltip 带来 G2 在容器中的滚动条
2 participants