Skip to content

Commit 48b8131

Browse files
committed
🔪 annotation/shape/image extra defaults step for category axes
... in Plots.doCalcdata - this approach was flawed: led to position value not updating properly on calc-less update (e.g. zoom/pan)
1 parent 134b54e commit 48b8131

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/plots/plots.js

+3-21
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ plots.doCalcdata = function(gd, traces) {
20322032
}
20332033
}
20342034

2035-
var hasCategoryAxis = initCategories(axList);
2035+
initCategories(axList);
20362036

20372037
var hasCalcTransform = false;
20382038

@@ -2101,25 +2101,11 @@ plots.doCalcdata = function(gd, traces) {
21012101
}
21022102

21032103
Registry.getComponentMethod('fx', 'calc')(gd);
2104-
2105-
// To handle the case of components using category names as coordinates, we
2106-
// need to re-supply defaults for these objects now, after calc has
2107-
// finished populating the category mappings
2108-
// Any component that uses `Axes.coercePosition` falls into this category
2109-
if(hasCategoryAxis) {
2110-
var dataReferencedComponents = ['annotations', 'shapes', 'images'];
2111-
for(i = 0; i < dataReferencedComponents.length; i++) {
2112-
Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')(
2113-
gd.layout, fullLayout, fullData);
2114-
}
2115-
}
21162104
};
21172105

2106+
// initialize the category list, if there is one, so we start over
2107+
// to be filled in later by ax.d2c
21182108
function initCategories(axList) {
2119-
var hasCategoryAxis = false;
2120-
2121-
// initialize the category list, if there is one, so we start over
2122-
// to be filled in later by ax.d2c
21232109
for(var i = 0; i < axList.length; i++) {
21242110
axList[i]._categories = axList[i]._initialCategories.slice();
21252111

@@ -2128,11 +2114,7 @@ function initCategories(axList) {
21282114
for(var j = 0; j < axList[i]._categories.length; j++) {
21292115
axList[i]._categoriesMap[axList[i]._categories[j]] = j;
21302116
}
2131-
2132-
if(axList[i].type === 'category') hasCategoryAxis = true;
21332117
}
2134-
2135-
return hasCategoryAxis;
21362118
}
21372119

21382120
plots.rehover = function(gd) {

0 commit comments

Comments
 (0)