Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 538710c

Browse files
archmojetpinard
authored andcommitted
fix to enable callbacks e.g. restyle to redraw
1 parent e03d686 commit 538710c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/traces/parcoords/parcoords.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,20 @@ module.exports = function(root, svg, parcoordsLineLayers, styledData, layout, ca
456456

457457
parcoordsLineLayer
458458
.each(function(d) {
459-
460459
if(d.viewModel) {
461-
if(d.lineLayer) d.lineLayer.update(d);
462-
else d.lineLayer = lineLayerMaker(this, d);
460+
if((!d.lineLayer) ||
461+
(callbacks)) { // recreate in case of having callbacks e.g. restyle, Should we explicitly test for callback to be a restyle?
462+
d.lineLayer = lineLayerMaker(this, d);
463+
} else d.lineLayer.update(d);
463464

464-
d.viewModel[d.key] = d.lineLayer;
465+
if (d.key) {
466+
d.viewModel[d.key] = d.lineLayer;
465467

466-
var setChanged = ((d.key) &&
467-
(((d.key !== 'contextLayer') || (callbacks)) || // unless there is callback on this line layer
468-
(!d.context))); // don't update background
468+
var setChanged = ((!d.context) || // don't update background
469+
((d.key !== 'contextLayer') || (callbacks))); // unless there is a callback on this line layer
469470

470-
d.lineLayer.render(d.viewModel.panels, setChanged);
471+
d.lineLayer.render(d.viewModel.panels, setChanged);
472+
}
471473
}
472474
});
473475

0 commit comments

Comments
 (0)