Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1673,12 +1673,16 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
var trace = gd._fullData[traceIdx];
var module = trace._module;

if(!module || !module.animatable) {
continue;
// There's nothing to do if this module is not defined:
if(!module) continue;

// Don't register the trace as transitioned if it doens't know what to do.
// If it *is* registered, it will receive a callback that it's responsible
// for calling in order to register the transition as having completed.
if(module.animatable) {
transitionedTraces.push(traceIdx);
}

transitionedTraces.push(traceIdx);

gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]);
}

Expand Down
31 changes: 31 additions & 0 deletions test/jasmine/tests/animate_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,34 @@ describe('Animate API details', function() {
}).catch(fail).then(done);
});
});

describe('non-animatable fallback', function() {
'use strict';
var gd;

beforeEach(function() {
gd = createGraphDiv();
});

afterEach(function() {
Plotly.purge(gd);
destroyGraphDiv();
});

it('falls back to a simple update for bar graphs', function(done) {
Plotly.plot(gd, [{
x: [1, 2, 3],
y: [4, 5, 6],
type: 'bar'
}]).then(function() {
expect(gd.data[0].y).toEqual([4, 5, 6]);

return Plotly.animate(gd, [{
data: [{y: [6, 4, 5]}]
}], {frame: {duration: 0}});
}).then(function() {
expect(gd.data[0].y).toEqual([6, 4, 5]);
}).catch(fail).then(done);

});
});