Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit af15b34

Browse filesBrowse files
committed
assume redoing calcdata is neccessary when restyling attr containers
1 parent caade64 commit af15b34
Copy full SHA for af15b34

File tree

Expand file treeCollapse file tree

2 files changed

+24
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-0
lines changed

‎src/plot_api/plot_api.js

Copy file name to clipboardExpand all lines: src/plot_api/plot_api.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,11 @@ function _restyle(gd, aobj, _traces) {
15801580
var moduleAttrs = (contFull._module || {}).attributes || {};
15811581
var valObject = Lib.nestedProperty(moduleAttrs, ai).get() || {};
15821582

1583+
// if restyling entire attribute container, assume worse case
1584+
if(!valObject.valType) {
1585+
flags.docalc = true;
1586+
}
1587+
15831588
if(valObject.arrayOk && (Array.isArray(newVal) || Array.isArray(oldVal))) {
15841589
flags.docalc = true;
15851590
}

‎test/jasmine/tests/plot_api_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/plot_api_test.js
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,25 @@ describe('Test plot api', function() {
330330
expect(PlotlyInternal.plot).toHaveBeenCalled();
331331
});
332332

333+
it('should do full replot when attribute container are updated', function() {
334+
var gd = {
335+
data: [{x: [1, 2, 3], y: [1, 2, 3]}],
336+
layout: {
337+
xaxis: { range: [0, 4] },
338+
yaxis: { range: [0, 4] }
339+
}
340+
};
341+
342+
mockDefaultsAndCalc(gd);
343+
Plotly.restyle(gd, {
344+
marker: {
345+
color: ['red', 'blue', 'green']
346+
}
347+
});
348+
expect(gd.calcdata).toBeUndefined();
349+
expect(PlotlyInternal.plot).toHaveBeenCalled();
350+
});
351+
333352
it('calls plot on xgap and ygap styling', function() {
334353
var gd = {
335354
data: [{z: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], showscale: false, type: 'heatmap'}],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.