Skip to content
Permalink
Browse files
handle case where axis id is undefined
however there's a funny case when running
./test/image/mocks/sunburst_with-without_values.json where
xAx (local function) gets passed an array in
./src/components/shapes/defaults.js (it expects a string or undefined).
So we still need to solve this.
  • Loading branch information
nicholas-esterer committed Jul 2, 2020
1 parent 83a7452 commit f9e05bc334cd06606afa3322f267f98e4467e7ec
Showing with 8 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +6 −2 src/components/shapes/defaults.js
  3. +1 −1 src/plots/cartesian/axis_ids.js
@@ -7,6 +7,7 @@ build/*
npm-debug.log*
*.sublime*
*~
tags

.*
!.circleci
@@ -64,11 +64,15 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
var coerceRefExtras=['paper'];
// extract axis if domain specified
var xAx = function (ar) {
var mtch = ar.match(/^([xyz][0-9]*) domain/);
var mtch = ar ? ar.match(/^([xyz][0-9]*) domain/) : undefined;
if (mtch) { return mtch[1]; }
return ar;
}
var axNumMatch = shapeIn[axLetter+'ref'].match(/[xyz]([0-9]*)/);
var axNumMatch = (
shapeIn[axLetter+'ref'] ?
shapeIn[axLetter+'ref'].match(/[xyz]([0-9]*)/) :
undefined
);
if (axNumMatch) {
let axNum = axNumMatch[1];
coerceRefExtras = coerceRefExtras.concat(
@@ -83,7 +83,7 @@ exports.listIds = function(gd, axLetter) {
exports.getFromId = function(gd, id, type) {
var fullLayout = gd._fullLayout;
// remove "domain" suffix
id = id.replace(/ *domain/,'');
id = (id == undefined) ? id : id.replace(/ *domain/,'');

if(type === 'x') id = id.replace(/y[0-9]*/, '');
else if(type === 'y') id = id.replace(/x[0-9]*/, '');

0 comments on commit f9e05bc

Please sign in to comment.