File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -126,25 +126,30 @@ module.exports = function setConvert(ax, fullLayout) {
126
126
*/
127
127
function setCategoryIndex ( v ) {
128
128
if ( v !== null && v !== undefined ) {
129
+ if ( ax . _categoriesMap === undefined )
130
+ ax . _categoriesMap = { } ;
129
131
130
- if ( ax . _categoriesMap [ v ] === undefined ) {
132
+ if ( ax . _categoriesMap [ v ] !== undefined ) {
133
+ return ax . _categoriesMap [ v ] ;
134
+ } else {
131
135
ax . _categories . push ( v ) ;
132
136
133
137
var curLength = ax . _categories . length - 1 ;
134
138
ax . _categoriesMap [ v ] = curLength ;
135
139
136
140
return curLength ;
137
141
}
138
- return ax . _categoriesMap [ v ] ;
139
142
}
140
143
return BADNUM ;
141
144
}
142
145
143
146
function getCategoryIndex ( v ) {
144
147
// d2l/d2c variant that that won't add categories but will also
145
148
// allow numbers to be mapped to the linearized axis positions
146
- var index = ax . _categories . indexOf ( v ) ;
147
- if ( index !== - 1 ) return index ;
149
+ if ( ax . _categoriesMap )
150
+ var index = ax . _categoriesMap [ v ] ?ax . _categoriesMap :undefined ;
151
+
152
+ if ( index !== undefined ) return index ;
148
153
if ( typeof v === 'number' ) return v ;
149
154
}
150
155
You can’t perform that action at this time.
0 commit comments