Skip to content

Commit b3d27bd

Browse files
committed
skip dims with conflicting axis types
1 parent f3c73db commit b3d27bd

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

src/traces/splom/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ function calc(gd, trace) {
5959
xa = AxisIDs.getFromId(gd, trace._diag[i][0]);
6060
ya = AxisIDs.getFromId(gd, trace._diag[i][1]);
6161

62+
// if corresponding x & y axes don't have matching types, skip dim
63+
if(xa && ya && xa.type !== ya.type) continue;
64+
6265
if(xa) {
6366
makeCalcdata(xa, dim);
6467
if(ya && ya.type === 'category') {
6568
ya._categories = xa._categories.slice();
6669
}
67-
} else if(ya) {
70+
} else {
71+
// should not make it here, if both xa and ya undefined
6872
makeCalcdata(ya, dim);
69-
if(xa && xa.type === 'category') {
70-
xa._categories = ya._categories.slice();
71-
}
7273
}
7374
}
7475
}

test/jasmine/tests/splom_test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,36 @@ describe('Test splom trace defaults:', function() {
359359
});
360360
});
361361

362+
describe('Test splom trace calc step:', function() {
363+
var gd;
364+
365+
function _calc(opts, layout) {
366+
gd = {};
367+
368+
gd.data = [Lib.extendFlat({type: 'splom'}, opts || {})];
369+
gd.layout = layout || {};
370+
supplyAllDefaults(gd);
371+
Plots.doCalcdata(gd);
372+
}
373+
374+
it('should skip dimensions with conflicting axis types', function() {
375+
_calc({
376+
dimensions: [{
377+
values: [1, 2, 3]
378+
}, {
379+
values: [2, 1, 2]
380+
}]
381+
}, {
382+
xaxis: {type: 'category'},
383+
yaxis: {type: 'linear'}
384+
});
385+
386+
var cd = gd.calcdata[0][0];
387+
388+
expect(cd.t._scene.matrixOptions.data).toBeCloseTo2DArray([[2, 1, 2]]);
389+
});
390+
});
391+
362392
describe('@gl Test splom interactions:', function() {
363393
var gd;
364394

0 commit comments

Comments
 (0)