如何从d3饼图中删除光标指针

时间:2022-01-18 14:59:52

Is there an option that disables the "cursor: pointer" style from the c3|d3 pie chart? I simply display slices and on hover just show the % percentage and a label, do not need the pointer because it is misunderstood as a link to somewhere, yet it is the default cursor...

是否有一个选项可以禁用c3 | d3饼图中的“cursor:pointer”样式?我只是显示切片并在悬停时只显示%百分比和标签,不需要指针,因为它被误解为某个地方的链接,但它是默认光标...

Update 1: I found a workaround, but it does not answer my question..

更新1:我找到了解决方法,但它没有回答我的问题..

onrendered: function () { $('#my_chart_id .c3-shape').css('cursor', 'default'); }

2 个解决方案

#1


I think the most straight-forward thing to do would be to use D3 to select each arc of the pie and change the cursor style, like this:

我认为最直接的做法是使用D3来选择饼图的每个弧并更改光标样式,如下所示:

d3.selectAll(".c3-arc").style("cursor", "auto");

Fiddle here: http://jsfiddle.net/henbox/k9Dbf/270/

在这里小提琴:http://jsfiddle.net/henbox/k9Dbf/270/

Cursor style options here: http://www.w3schools.com/cssref/pr_class_cursor.asp

光标样式选项在这里:http://www.w3schools.com/cssref/pr_class_cursor.asp

#2


Via CSS override:

通过CSS覆盖:

.c3-shape {
  cursor: default !important;
}

#1


I think the most straight-forward thing to do would be to use D3 to select each arc of the pie and change the cursor style, like this:

我认为最直接的做法是使用D3来选择饼图的每个弧并更改光标样式,如下所示:

d3.selectAll(".c3-arc").style("cursor", "auto");

Fiddle here: http://jsfiddle.net/henbox/k9Dbf/270/

在这里小提琴:http://jsfiddle.net/henbox/k9Dbf/270/

Cursor style options here: http://www.w3schools.com/cssref/pr_class_cursor.asp

光标样式选项在这里:http://www.w3schools.com/cssref/pr_class_cursor.asp

#2


Via CSS override:

通过CSS覆盖:

.c3-shape {
  cursor: default !important;
}