Skip to content

Commit

Permalink
convert invalid categories coords to middle of axis range
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
etpinard committed Jun 16, 2017
1 parent aaf12ba commit 0758b3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/plots/cartesian/set_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,17 @@ module.exports = function setConvert(ax, fullLayout) {
ax.d2c = ax.d2l = setCategoryIndex;
ax.r2d = ax.c2d = ax.l2d = getCategoryName;

ax.r2c = ax.d2r = ax.d2l_noadd = getCategoryIndex;
ax.d2r = ax.d2l_noadd = getCategoryIndex;

ax.r2c = function(v) {
var index = getCategoryIndex(v);
return index !== undefined ? index : ax.fraction2r(0.5);
};

ax.l2r = ax.c2r = ensureNumber;
ax.r2l = getCategoryIndex;

ax.d2p = function(v) { return ax.l2p(getCategoryIndex(v)); };
ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); };
ax.p2d = function(px) { return getCategoryName(p2l(px)); };
ax.r2p = ax.d2p;
ax.p2r = p2l;
Expand Down

0 comments on commit 0758b3b

Please sign in to comment.