//Returns an event handler for fading a given chord group.
function fade(opacity) {
return function(d,i) {
svg.selectAll("path.chord")
.filter(function(d) { return d.source.index !== i && d.target.index !== i; })
.transition()
.style("opacity", opacity);
};
}//fadevar total = 10000,
values = [1200, 3400, 400, 2500, 2000, 500];
/**
* Highlight hovered over arc
* @param {Object} d
*/
mouseoverArc: function (d) {
//Decrease opacity to all
svg.selectAll("path.chord")
.transition()
.style("opacity", 0.1);
//Show hovered over chord with full opacity
d3.select(this)
.transition()
.style("opacity", 1);
console.dir(d);
//Define and show the tooltip over the mouse location
$(this).popover({
placement: 'auto top',
container: 'body',
mouseOffset: 10,
followMouse: true,
trigger: 'hover',
html : true,
content: (function() {
return "<p style='font-size: 11px; text-align: center;'><span style='font-weight:900'>" + values[d.index] +
"</span> and <span style='font-weight:900'>" + values[d.index] +
"</span> appeared together in <span style='font-weight:900'>" + d.value + "</span> movies </p>";
}())
});
$(this).popover('show');
},//mouseoverArc
// Draw outer Arcs
outerArcs = svg.selectAll("g.group")
.data(chord.groups)
.enter()
.append("g")
.attr("class", "group")
.on("mouseover", mouseoverArc)
.on("mouseout", mouseoutChord);
//.on("mouseover", self.fade(0.1))
//.on("mouseout", self.fade(opacityDefault)); mouseoverArc: function (d, i) {
var value = values[d.index];
//Decrease opacity to all
svg.selectAll("path.chord")
.filter(function(d) {
return ((d.source.index !== i) && (d.target.index !== i));
})
.transition()
.style("opacity", 0.1);
//Show hovered over chord with full opacity
d3.select(this)
//.filter(self.fade(0.1))
.transition()
.style("opacity", 1);
console.dir(d);
//Define and show the tooltip over the mouse location
jq(this).popover({
placement: 'auto top',
container: 'body',
mouseOffset: 10,
followMouse: true,
trigger: 'hover',
html : true,
content: (function() {
return "<p style='font-size: 11px; text-align: center;'>Appeared in <span style='font-weight:900'>" + ((value * 100) / total) + "% </span> movies </p>";
}())
});
jq(this).popover('show');
},//mouseoverArc.filter(function(d) {
return ((d.source.index !== i) && (d.target.index !== i));
})