Skip to content

Commit 0758b3b

Browse files
committed
convert invalid categories coords to middle of axis range
- same as what Axes.coercePosition does at the defaults step for other axis types - post #1748, we need to handle this at the ax.r2c as the categories are only known after the calc step.
1 parent aaf12ba commit 0758b3b

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
@@ -231,12 +231,17 @@ module.exports = function setConvert(ax, fullLayout) {
231231
ax.d2c = ax.d2l = setCategoryIndex;
232232
ax.r2d = ax.c2d = ax.l2d = getCategoryName;
233233

234-
ax.r2c = ax.d2r = ax.d2l_noadd = getCategoryIndex;
234+
ax.d2r = ax.d2l_noadd = getCategoryIndex;
235+
236+
ax.r2c = function(v) {
237+
var index = getCategoryIndex(v);
238+
return index !== undefined ? index : ax.fraction2r(0.5);
239+
};
235240

236241
ax.l2r = ax.c2r = ensureNumber;
237242
ax.r2l = getCategoryIndex;
238243

239-
ax.d2p = function(v) { return ax.l2p(getCategoryIndex(v)); };
244+
ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); };
240245
ax.p2d = function(px) { return getCategoryName(p2l(px)); };
241246
ax.r2p = ax.d2p;
242247
ax.p2r = p2l;

0 commit comments

Comments
 (0)