G2 icon indicating copy to clipboard operation
G2 copied to clipboard

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

Open love123724 opened this issue 3 years ago • 1 comments
trafficstars

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

love123724 avatar Jul 27 '22 09:07 love123724

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

ai-qing-hai avatar Aug 05 '22 02:08 ai-qing-hai

两种方式: 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 avatar Aug 21 '22 05:08 visiky