From 598a67bce659e737ecb4dfe11a645135b60f31a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 21 Feb 2019 16:20:13 -0500 Subject: [PATCH] improve ax.clearCalc: - 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. --- src/plots/cartesian/set_convert.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plots/cartesian/set_convert.js b/src/plots/cartesian/set_convert.js index 637a1a5e56b..941d01de3e7 100644 --- a/src/plots/cartesian/set_convert.js +++ b/src/plots/cartesian/set_convert.js @@ -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 = {}; }; @@ -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) {