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

鼠标移动到pie状图时,鼠标无法变成小手 #4054

Closed
1 task
love123724 opened this issue Jul 27, 2022 · 2 comments
Closed
1 task

鼠标移动到pie状图时,鼠标无法变成小手 #4054

love123724 opened this issue Jul 27, 2022 · 2 comments

Comments

@love123724
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

有时候需要点击饼状图跳转某个页面,如果能变成小手能让用户体验更好

What does the proposed API look like?

new G2.Chart({
container: {string} | {HTMLDivElement},
cursor?:true
});

@ai-qing-hai
Copy link
Collaborator

chart
.interval()
.adjust('stack')
.position('value')
.color('type')
.style({
cursor:'pointer'
}); 在 style 上可以添加

@visiky
Copy link
Member

visiky commented Aug 21, 2022

两种方式:
1、直接在 style 中设置
2、鼠标也是一种交互: 自定义一个 interaction,事件触发为 element 的 mouseenter 或 mouseeleave,具体的交互反馈是鼠标的样式变化,伪代码如下:

registerInteraction('pie-cursor-interaction', {
  start: [
    { trigger: 'element:mouseenter', action: ['cursor:pointer'] },
  ],
  end: [
    { trigger: 'element:mouseleave', action: ['cursor:default'] },
  ]
})

chart.interaction('pie-cursor-interaction')

@visiky visiky closed this as completed Aug 21, 2022
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

No branches or pull requests

3 participants