ChartJS鼠标移到图例上显示手形

在Chart options中添加:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 给图例加手势
legend: {
onHover: function(e) {
e.target.style.cursor = 'pointer';
}
},

// 给图加手势
hover: {
onHover: function(e) {
var point = this.getElementAtEvent(e);
if (point.length) {
e.target.style.cursor = 'pointer';
} else {
e.target.style.cursor = 'default';
}
}
}

ChartJS鼠标移到图例上显示手形

https://www.imaegoo.com/2018/chartjs-pointer-cursor/

作者

iMaeGoo

发布于

2018-03-02

更新于

2018-03-02

许可协议

CC BY 4.0

评论