Skip to content

Commit 1ffcdca

Browse files
committed
add anim:true to sunburst level
... making it smoothly transition with Plotly.react
1 parent a8411c1 commit 1ffcdca

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/traces/sunburst/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module.exports = {
6161
level: {
6262
valType: 'any',
6363
editType: 'plot',
64+
anim: true,
6465
role: 'info',
6566
description: [
6667
'Sets the level from which this sunburst trace hierarchy is rendered.',

test/jasmine/tests/sunburst_test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,4 +1195,23 @@ describe('Test sunburst interactions edge cases', function() {
11951195
.catch(failTest)
11961196
.then(done);
11971197
});
1198+
1199+
it('should be able to transition sunburst traces via `Plotly.react`', function(done) {
1200+
var mock = Lib.extendDeep({}, require('@mocks/sunburst_pie_cartesian.json'));
1201+
mock.layout.transition = {duration: 200};
1202+
1203+
spyOn(Plots, 'transitionFromReact').and.callThrough();
1204+
1205+
Plotly.plot(gd, mock)
1206+
.then(function() {
1207+
gd.data[1].level = 'B';
1208+
return Plotly.react(gd, gd.data, gd.layout);
1209+
})
1210+
.then(delay(202))
1211+
.then(function() {
1212+
expect(Plots.transitionFromReact).toHaveBeenCalledTimes(1);
1213+
})
1214+
.catch(failTest)
1215+
.then(done);
1216+
});
11981217
});

0 commit comments

Comments
 (0)