admin管理员组文章数量:1357307
In pie charts c3js by default shows a hand cursor (pointer) when pie slice is hovered. I would like to have the same behavior for each bars in a bar chart. How to achieve that?
I tried the below css but it shows the hand cursor even when you hover in between 2 bars.
.c3-event-rect {
cursor:pointer;
}
To clarify this is a jsfiddle example I'd like to have pointer cursor only on bar items because only them are clickable.
In pie charts c3js by default shows a hand cursor (pointer) when pie slice is hovered. I would like to have the same behavior for each bars in a bar chart. How to achieve that?
I tried the below css but it shows the hand cursor even when you hover in between 2 bars.
.c3-event-rect {
cursor:pointer;
}
To clarify this is a jsfiddle example I'd like to have pointer cursor only on bar items because only them are clickable.
Share Improve this question edited Sep 22, 2015 at 11:47 zmark asked Sep 22, 2015 at 9:24 zmarkzmark 1272 silver badges12 bronze badges2 Answers
Reset to default 8After way too much time spent, I finally figured out a solution. Here is a jsfiddle, which explains the two lines of code in some detail (in ments).
If you don't understand the details, don't worry about it or just ask me to elaborate. :)
tl;dr:
data: { selection: { enabled: true }, [...]
.c3-bar { cursor: pointer; }
Just use the following CSS
.c3-bar {
pointer-events: auto !important;
}
Note that you need the !important
to override the inline pointer-events: none
that C3 adds to the bars.
本文标签: javascriptc3jshow to show hand cursor on bar chart hoverStack Overflow
版权声明:本文标题:javascript - c3.js - how to show hand cursor on bar chart hover - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744001425a2573925.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论