Skip to content

Commit

Permalink
improve ax.clearCalc:
Browse files Browse the repository at this point in the history
- mv for-else call after for loop
- rename init() -> emptyCategories()
- break after finding group in which ax is in - as one ax can
  only be in a single match group at a time.
  • Loading branch information
etpinard committed Feb 21, 2019
1 parent c48ae1c commit 598a67b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plots/cartesian/set_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ module.exports = function setConvert(ax, fullLayout) {

// should skip if not category nor multicategory
ax.clearCalc = function() {
var init = function() {
var emptyCategories = function() {
ax._categories = [];
ax._categoriesMap = {};
};
Expand Down Expand Up @@ -606,14 +606,14 @@ module.exports = function setConvert(ax, fullLayout) {
ax._categories = categories;
ax._categoriesMap = categoriesMap;
} else {
init();
emptyCategories();
}
break;
}

if(!found) init();
}
if(!found) emptyCategories();
} else {
init();
emptyCategories();
}

if(ax._initialCategories) {
Expand Down

0 comments on commit 598a67b

Please sign in to comment.