Skip to content

Commit a141d78

Browse files
committed
robustify pie clean step:
- so that it works in cases where _has isn't defined e.g. via Plotly.purge().
1 parent 77fb7e2 commit a141d78

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/plots/plots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ plots.getSubplotIds = function getSubplotIds(layout, type) {
193193
if(type === 'cartesian' && (!layout._has || !layout._has('cartesian'))) return [];
194194
if(type === 'gl2d' && (!layout._has || !layout._has('gl2d'))) return [];
195195
if(type === 'cartesian' || type === 'gl2d') {
196-
return Object.keys(layout._plots || {});
196+
return Object.keys(layout._plots);
197197
}
198198

199199
var idRegex = _module.idRegex,

src/traces/pie/base_plot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ exports.plot = function(gd) {
2121
};
2222

2323
exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {
24-
if(oldFullLayout._hasPie && !newFullLayout._hasPie) {
24+
var hadPie = (oldFullLayout._has && oldFullLayout._has('pie'));
25+
var hasPie = (newFullLayout._has && newFullLayout._has('pie'));
26+
27+
if(hadPie && !hasPie) {
2528
oldFullLayout._pielayer.selectAll('g.trace').remove();
2629
}
2730
};

0 commit comments

Comments
 (0)