in src/chart.js [600:796]
function position(mark) {
var mark_transition;
if (animation == 'off' && tilt == 'off' && !touching){
mark_transition = mark.transition()
.delay(function(d,i){
return i * 10;
})
.duration(500);
}
else if (animation == 'on' && tilt == 'off'){
mark_transition = mark.transition()
.delay(function(d,i){
return i * (50 / data.length);
})
.duration(50);
}
else {
mark_transition = mark;
}
mark_transition.select('circle')
.attr("cx", function (d) {
return (d[params.x] != null) ? scale_x(d[params.x]) : - facet_dim;
})
.style("stroke", function(d){
if (facets == 'on') {
return '#999';
}
else if (bubbleset_points.indexOf(d[params.key]) != -1) {
return 'gold';
}
else {
return '#fff';
}
})
.style("opacity", function(d){
if ((focus_x < 0 || focus_x > (num_facet_cols - 1)) && (focus_y_facet < 0 || focus_y_facet > (num_facet_cols - 1))) {
if (facets == 'off' && bubbleset_points.length != 0) {
if (bubbleset_points.indexOf(d[params.key]) != -1) {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',0.75);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark_highlighted');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display',null);
}
if (highlight_points.indexOf(d[params.key]) == -1){
highlight_points.push(d[params.key]);
}
return 0.75;
}
else {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',0.175);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display','none');
}
if (highlight_points.indexOf(d[params.key]) != -1){
highlight_points.splice(highlight_points.indexOf(d[params.key]),1);
}
return 0.175;
}
}
else {
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display','none');
}
if (highlight_points.indexOf(d[params.key]) != -1){
highlight_points.splice(highlight_points.indexOf(d[params.key]),1);
}
d3.select('#line_' + d[params.key]).select('path').style('opacity', facets == 'on' ? 1 : 0.5);
return (facets == 'on' ? 1 : 0.5);
}
}
else {
if (facets == 'on') {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',1);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display',null);
}
if (highlight_points.indexOf(d[params.key]) != -1){
highlight_points.splice(highlight_points.indexOf(d[params.key]),1);
}
return 1;
}
else {
if (bubbleset_points.indexOf(d[params.key]) != -1) {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',0.75);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark_highlighted');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display',null);
}
if (highlight_points.indexOf(d[params.key]) == -1){
highlight_points.push(d[params.key]);
}
return 0.75;
}
else if ((d[params.y] >= focus_y_lower && d[params.y] < focus_y_upper) || (d[params.x] >= focus_x_lower && d[params.x] < focus_x_upper)) {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',0.75);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark_highlighted');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display',null);
}
if (highlight_points.indexOf(d[params.key]) == -1){
highlight_points.push(d[params.key]);
}
return 0.75;
}
else {
d3.select('#line_'+ d[params.key]).select('path').style('opacity',0.175);
d3.select('#text_mark_' + d[params.key]).attr("class", 'text_mark');
if (!non_interactive) {
d3.select('#' + d[params.key] + '_bttn').style('display','none');
}
if (highlight_points.indexOf(d[params.key]) != -1){
highlight_points.splice(highlight_points.indexOf(d[params.key]),1);
}
return 0.175;
}
}
}
})
.attr("cy", function (d) {
return d[params.y] != null ? scale_y(d[params.y]) : - facet_dim;
})
.attr("r", function (d) {
return (d[params.y] != null && d[params.x] != null) ? scale_pop(Math.sqrt(d[params.radius])) : 0;
})
.attr('transform', function (d) {
if (facets == 'on') {
return 'translate(' + (facet_dim * (d[params.facet] % num_facet_cols)) + ',' + (facet_dim * Math.floor(d[params.facet] / num_facet_cols)) + ')';
}
else {
return 'translate(0,0)';
}
});
mark_transition.select('text')
.attr("x", function (d) {
return facets == 'on' ? 0 : ((d[params.x] != null) ? scale_x(d[params.x]) : - facet_dim);
})
.attr("dy", facets == "on" ? '-1em' : '0em')
// .style('visibility', function(d){
// if (facets == 'on') {
// return 'visible';
// }
// else if (d[params.y] != null && d[params.x] != null){
// return 'visible';
// }
// else {
// return 'hidden';
// }
// })
// .style("display", function(d){
// if (non_interactive) {
// return null;
// }
// else if (bubbleset_points.indexOf(d[params.key]) != -1) {
// return null;
// }
// else if ((focus_x < 0 || focus_x > (num_facet_cols - 1)) && (focus_y_facet < 0 || focus_y_facet > (num_facet_cols - 1))) {
// return facets == 'on' ? null : 'none';
// }
// else {
// if (facets == 'on') {
// if (d[params.facet] % num_facet_cols == focus_x || Math.floor(d[params.facet] / num_facet_cols) == focus_y) {
// return null;
// }
// else {
// return 'none';
// }
// }
// else {
// if ((d[params.y] >= focus_y_lower && d[params.y] < focus_y_upper) || (d[params.x] >= focus_x_lower && d[params.x] < focus_x_upper)) {
// return null;
// }
// else {
// return 'none';
// }
// }
// }
// })
.attr("y", function (d) {
return facets == 'on' ? 0 : (d[params.y] != null ? scale_y(d[params.y]) : - facet_dim);
})
.attr('transform', function (d) {
if (facets == 'on') {
return 'translate(' + (facet_dim * (d[params.facet] % num_facet_cols) + facet_dim * 0.5) + ',' + (facet_dim * Math.floor(d[params.facet] / num_facet_cols) + facet_dim) + ')';
}
else {
return 'translate(0,0)';
}
});
}