Skip to content

Commit

Permalink
In line and stackedArea, removed the exit() transitions. They cause t…
Browse files Browse the repository at this point in the history
…oo many bugs and are not necessary for chart transitions to look nice.

Updated version to 1.1.14
  • Loading branch information
robinfhu committed Oct 8, 2013
1 parent 4c6c8da commit 7472209
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
7 changes: 5 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var nv = window.nv || {};


nv.version = '1.1.13b';
nv.version = '1.1.14b';
nv.dev = true //set false when in production

window.nv = nv;
Expand Down Expand Up @@ -67,7 +67,10 @@ nv.render = function render(step) {
nv.render.queue.splice(0, i);

if (nv.render.queue.length) setTimeout(arguments.callee, 0);
else { nv.render.active = false; nv.dispatch.render_end(); }
else {
nv.dispatch.render_end();
nv.render.active = false;
}
}, 0);
};

Expand Down
26 changes: 8 additions & 18 deletions src/models/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nv.models.line = function() {
.size(16) // default size
.sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor
;

//============================================================


Expand Down Expand Up @@ -108,11 +108,9 @@ nv.models.line = function() {
groups.enter().append('g')
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6);
groups.exit()
.transition()
.style('stroke-opacity', 1e-6)
.style('fill-opacity', 1e-6)
.remove();

groups.exit().remove();

groups
.attr('class', function(d,i) { return 'nv-group nv-series-' + i })
.classed('hover', function(d) { return d.hover })
Expand Down Expand Up @@ -141,7 +139,7 @@ nv.models.line = function() {
});
groups.exit().selectAll('path.nv-area')
.remove();

areaPaths
.transition()
.attr('d', function(d) {
Expand All @@ -168,15 +166,7 @@ nv.models.line = function() {
.x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) })
.y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) })
);
groups.exit().selectAll('path.nv-line')
.transition()
.attr('d',
d3.svg.line()
.interpolate(interpolate)
.defined(defined)
.x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) })
.y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) })
);

linePaths
.transition()
.attr('d',
Expand Down Expand Up @@ -206,11 +196,11 @@ nv.models.line = function() {
chart.dispatch = scatter.dispatch;
chart.scatter = scatter;

d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange',
'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights');

chart.options = nv.utils.optionsFunc.bind(chart);

chart.margin = function(_) {
if (!arguments.length) return margin;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
Expand Down
6 changes: 3 additions & 3 deletions src/models/stackedArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ nv.models.stackedArea = function() {
seriesIndex: d.seriesIndex
});
})
path.exit().transition()
.attr('d', function(d,i) { return zeroArea(d.values,i) })
.remove();

path.exit().remove();

path
.style('fill', function(d,i){
return d.color || color(d, d.seriesIndex)
Expand Down

0 comments on commit 7472209

Please sign in to comment.