score:6

Accepted answer

The easiest way to add a tooltip in SVG is to append a title element to the element you want to show a tooltip for (see e.g. this question).

In your code, this would look something like this.

svggraph.append("rect")
  // set attributes
  .append("title")
  .text(function(d) { return "Tooltip"; });

Related Query