antvis/G2

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

love123724 posted onGitHub

  • 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 });

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


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

posted by ai-qing-hai over 2 years ago

两种方式: 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')
posted by visiky over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests