in site/js/bowiePlot.js [235:330]
function update(m) {
metric = m;
if (typeof data === 'undefined') {
return false;
}
var currentData = data[metric];
var layout = graphLayout(currentData);
var t = d3.transition()
.duration(500);
arcs = svg.selectAll('.arc')
.data(layout.inArcs.concat(layout.outArcs), function (d) {
return d.type + d.index;
});
arcs.exit()
.attr('class', 'exit')
.transition(t)
.style('fill-opacity', 0)
.remove();
arcs = arcs.enter()
.append('path')
.attr('class', 'arc')
.merge(arcs);
arcs
.on('mouseover', function (d) {
highlight(d, 'arc');
showTooltip(currentData.in[d.index], d3.event.pageX, d3.event.pageY);
})
.on('mouseout', function (d) {
restore();
hideTooltip();
})
.transition(t)
// TODO: add arc tweens
.attr('d', arc)
.style('fill', function (d) { return color(currentData.in[d.index].elementGroup); });
chords = svg.selectAll('.chord')
.data(layout.inChords.concat(layout.outChords), function (d) {
return d.index + d.type + d.subindex;
});
chords.exit()
.attr('class', 'exit')
.transition(t)
.style('fill-opacity', 0)
.remove();
chords = chords.enter()
.append('path')
.attr('class', 'chord')
.style('fill', '#B0B9BE')
.merge(chords);
chords
.transition(t)
.attr('d', ribbon)
.style('fill-opacity', 0.5);
circles = svg.selectAll('.node')
.data($.map(layout.blt, function (val) { return val; }), function (d) { return d.index; });
circles.exit()
.attr('class', 'exit')
.transition(t)
.attr('r', 0)
.remove();
circles = circles.enter()
.append('circle')
.attr('class', 'node')
.merge(circles);
circles
.on('mouseover', function (d) {
highlight(d, 'circle');
showTooltip(currentData.in[d.index], d3.event.pageX, d3.event.pageY);
})
.on('mouseout', function (d) {
restore();
hideTooltip();
})
.transition(t)
.attr('r', function (d) { return d.r; })
.attr('cx', function (d) { return d.x; })
.attr('cy', function (d) { return d.y; })
.style('fill', function (d) {
return color(currentData.in[d.index].elementGroup)
})
.style('fill-opacity', 0.75);
}