# HG changeset patch # User IBBoard # Date 1496066298 -3600 # Node ID ce99564f2eb520137448e54cfdc9cf8ed405dd17 # Parent c1d89ae900d57c33088e33af1b323f2b54a925e6 Fix legend hover so that it doesn't stop in gap between label and gradient diff -r c1d89ae900d5 -r ce99564f2eb5 exif-graphr.js --- a/exif-graphr.js Mon May 29 14:31:41 2017 +0100 +++ b/exif-graphr.js Mon May 29 14:58:18 2017 +0100 @@ -330,19 +330,19 @@ var cameraLegends = legends.selectAll("g").data(cameras, byValue); cameraLegends.exit().remove(); var newCameraLegends = cameraLegends.enter().append("g") + .on('mouseover', function(d) { setCircleOpacity(d, 0.1); }) + .on('mouseout', function(d) { setCircleOpacity(d, 1); }); newCameraLegends.append("title").text(function(d){return d;}); + newCameraLegends.append("text") + .text(function(d){ return ": " + d; }) //Fudge positioning so that hover opacity doesn't stop between gradient and label + .attr("x", legendBlockWidth - 5) + .attr("y", function(d,i) { return i * legendBlockHeight + (legendBlockHeight / 4) * 3; }) newCameraLegends.append("rect") .attr("x", 0) .attr("y", function(d,i){ return i * legendBlockHeight; }) .attr("width", legendBlockWidth) .attr("height", legendBlockHeight) .attr("fill", function(d,i) { return "url(#Gradient" + i + ")"; }) - .on('mouseover', function(d) { setCircleOpacity(d, 0.1); }) - .on('mouseout', function(d) { setCircleOpacity(d, 1); }); - newCameraLegends.append("text") - .text(function(d){ return d; }) - .attr("x", legendBlockWidth + 5) - .attr("y", function(d,i) { return i * legendBlockHeight + (legendBlockHeight / 4) * 3; }); } function setCircleOpacity(camera, opacity) {