Skip to content

Commit aae3929

Browse files
authored
Merge pull request #2324 from plotly/parcoords-animation-fix
Add parcoords 'dimension' to list of array containers found in traces
2 parents 0af88a7 + 1ff7cbb commit aae3929

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

src/plots/plots.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ plots.extendObjectWithContainers = function(dest, src, containerPaths) {
19991999
return dest;
20002000
};
20012001

2002-
plots.dataArrayContainers = ['transforms'];
2002+
plots.dataArrayContainers = ['transforms', 'dimensions'];
20032003
plots.layoutArrayContainers = Registry.layoutArrayContainers;
20042004

20052005
/*

test/jasmine/tests/parcoords_test.js

+40-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var attributes = require('@src/traces/parcoords/attributes');
77

88
var createGraphDiv = require('../assets/create_graph_div');
99
var destroyGraphDiv = require('../assets/destroy_graph_div');
10+
var fail = require('../assets/fail_test');
1011
var mouseEvent = require('../assets/mouse_event');
1112
var supplyAllDefaults = require('../assets/supply_defaults');
1213

@@ -582,7 +583,7 @@ describe('@noCI parcoords', function() {
582583
expect(gd.data[1].dimensions[10].constraintrange).toEqual([100000, 150000]);
583584
expect(gd.data[1].dimensions[1].constraintrange).not.toBeDefined();
584585

585-
expect(document.querySelectorAll('.axis').length).toEqual(20); // one dimension is `visible: false`
586+
expect(document.querySelectorAll('.axis').length).toEqual(20); // one dimension is `visible: false`
586587

587588
done();
588589
});
@@ -773,6 +774,44 @@ describe('@noCI parcoords', function() {
773774

774775
});
775776

777+
it('Calling `Plotly.animate` with patches targeting `dimensions` attributes should do the right thing', function(done) {
778+
Plotly.newPlot(gd, [{
779+
type: 'parcoords',
780+
line: {color: 'blue'},
781+
dimensions: [{
782+
range: [1, 5],
783+
constraintrange: [1, 2],
784+
label: 'A',
785+
values: [1, 4]
786+
}, {
787+
range: [1, 5],
788+
label: 'B',
789+
values: [3, 1.5],
790+
tickvals: [1.5, 3, 4.5]
791+
}]
792+
}])
793+
.then(function() {
794+
return Plotly.animate(gd, {
795+
data: [{
796+
'line.color': 'red',
797+
'dimensions[0].constraintrange': [1, 4]
798+
}],
799+
traces: [0],
800+
layout: {}
801+
});
802+
})
803+
.then(function() {
804+
expect(gd.data[0].line.color).toBe('red');
805+
expect(gd.data[0].dimensions[0]).toEqual({
806+
range: [1, 5],
807+
constraintrange: [1, 4],
808+
label: 'A',
809+
values: [1, 4]
810+
});
811+
})
812+
.catch(fail)
813+
.then(done);
814+
});
776815
});
777816

778817
describe('Lifecycle methods', function() {

0 commit comments

Comments
 (0)