Accepted answer

You can do it like this:

      "mouseover": function(d) {"cursor", "pointer"); 
      "mouseout": function(d) {"cursor", "default"); 

working code here


you can simply work this out in the CSS.'cursor', 'pointer')


Setting the style dynamically in this case doesn't make any sense. If the mouse is over the element, the cursor style is applied. Otherwise, you are hovering over another element and the cursor style for that element is applied. So there is no reason to set the style dynamically based on mouseover events. You might as well just set the style on initialization."cursor", "pointer");

Or, just set the style in the CSS file as another answer indicated.


Did you just try this :

    var myCircle = svgContainer.selectAll(".dots")
      .attr("class", "dots")
      .attr("cx", function(d, i) {return d.centerX})
      .attr("cy", function(d, i) {return d.centerY})
      .attr("r", 5)
      .attr("stroke-width", 0)
      .attr("fill", function(d, i) {return "red"})
      .style("display", "block")
      .style("cursor", "pointer");

Because when you define cursor as a pointer for your object, when you "mouseover", then the pointer become a pointer.

See here an example :


Why don't you simply let CSS handle it?

.dots {
  cursor: pointer;

Related Query

More Query from same tag