Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #2 from diasks2/master
Browse files Browse the repository at this point in the history
Add tooltip to d3.punchcard
  • Loading branch information
jeyb committed Oct 20, 2013
2 parents e792860 + 264692f commit 5938fca
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions d3.punchcard.js
Expand Up @@ -115,11 +115,30 @@ for (i = 0; i < data.length; i++) {
enter().
append("circle").
style("fill", "#888").
on("mouseover", mover).
on("mouseout", mout).
on("mousemove", function() {
return tooltip.
style("top", (d3.event.pageY - 10) + "px").
style("left", (d3.event.pageX + 10) + "px");
}).
attr("r", function(d) { return d / max * 14; }).
attr("transform", function() {
tx = pane_left - 2 * margin + x(j);
ty = height - 7 * margin - y(i);
return "translate(" + tx + ", " + ty + ")";
});
}
function mover(d) {
tooltip = d3.select("body")
.append("div")
.style("position", "absolute")
.style("z-index", "99999")
.attr("class", "vis-tool-tip")
.text(d);
}

function mout(d) {
$(".vis-tool-tip").fadeOut(50).remove();
}
}

0 comments on commit 5938fca

Please sign in to comment.