removed transition and delay on tooltips, you can uncomment to revert this. Minor fix to scatter, points will keep custom classes after transiiton

master
Bob Monteverde 11 years ago
parent bb5146775e
commit 065c8eb84d

@ -22,6 +22,7 @@ nv.models.scatter = function() {
, forceY = [] // List of numbers to Force into the Y scale
, forceSize = [] // List of numbers to Force into the Size scale
, interactive = true // If true, plots a voronoi overlay for advanced point intersection
, pointKey = null
, pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out
, padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart
, padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding
@ -368,7 +369,7 @@ nv.models.scatter = function() {
if (onlyCircles) {
var points = groups.selectAll('circle.nv-point')
.data(function(d) { return d.values });
.data(function(d) { return d.values }, pointKey);
points.enter().append('circle')
.attr('cx', function(d,i) { return x0(getX(d,i)) })
.attr('cy', function(d,i) { return y0(getY(d,i)) })
@ -378,7 +379,11 @@ nv.models.scatter = function() {
.attr('cx', function(d,i) { return x(getX(d,i)) })
.attr('cy', function(d,i) { return y(getY(d,i)) })
.remove();
points.attr('class', function(d,i) { return 'nv-point nv-point-' + i });
points.each(function(d,i) {
d3.select(this)
.classed('nv-point', true)
.classed('nv-point-' + i, true);
});
points.transition()
.attr('cx', function(d,i) { return x(getX(d,i)) })
.attr('cy', function(d,i) { return y(getY(d,i)) })
@ -403,8 +408,12 @@ nv.models.scatter = function() {
return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
})
.remove();
points.attr('class', function(d,i) { return 'nv-point nv-point-' + i });
d3.transition(points)
points.each(function(d,i) {
d3.select(this)
.classed('nv-point', true)
.classed('nv-point-' + i, true);
});
points.transition()
.attr('transform', function(d,i) {
//nv.log(d,i,getX(d,i), x(getX(d,i)));
return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')'
@ -563,6 +572,12 @@ nv.models.scatter = function() {
return chart;
};
chart.pointKey = function(_) {
if (!arguments.length) return pointKey;
pointKey = _;
return chart;
};
chart.pointActive = function(_) {
if (!arguments.length) return pointActive;
pointActive = _;

@ -25,6 +25,7 @@
font-family: Arial;
font-size: 13px;
/*
transition: opacity 500ms linear;
-moz-transition: opacity 500ms linear;
-webkit-transition: opacity 500ms linear;
@ -32,6 +33,7 @@
transition-delay: 500ms;
-moz-transition-delay: 500ms;
-webkit-transition-delay: 500ms;
*/
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
@ -700,4 +702,4 @@ svg .title {
.nvd3 .axis text {
text-shadow: 0 1px 0 #fff;
}
}

Loading…
Cancel
Save