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

Skip to content

Commit 153f547

Browse files
committed
getCategoryIndex falls back to the former implementation to fix the failed unit test case
1 parent abcd729 commit 153f547

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/plots/cartesian/set_convert.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,13 @@ module.exports = function setConvert(ax, fullLayout) {
148148
// d2l/d2c variant that that won't add categories but will also
149149
// allow numbers to be mapped to the linearized axis positions
150150
var index;
151-
if(ax._categoriesMap) { index = ax._categoriesMap[v] ? ax._categoriesMap : undefined; }
152-
if(index !== undefined) { return index; }
151+
if(ax._categoriesMap) {
152+
index = ax._categoriesMap[v] ? ax._categoriesMap : undefined;
153+
if(index !== undefined) return index;
154+
} else {
155+
index = ax._categories.indexOf(v);
156+
if(index !== -1) return index;
157+
}
153158
if(typeof v === 'number') { return v; }
154159
}
155160

0 commit comments

Comments
 (0)