Skip to content

Commit 76c64e5

Browse files
committed
first cut splom auto axis type detection
1 parent 3be9569 commit 76c64e5

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/plots/cartesian/type_defaults.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function setAutoType(ax, data) {
4646
// only autotype if type is '-'
4747
if(ax.type !== '-') return;
4848

49-
var id = ax._id,
50-
axLetter = id.charAt(0);
49+
var id = ax._id;
50+
var axLetter = id.charAt(0);
5151

5252
// support 3d
5353
if(id.indexOf('scene') !== -1) id = axLetter;
@@ -63,18 +63,17 @@ function setAutoType(ax, data) {
6363
return;
6464
}
6565

66-
var calAttr = axLetter + 'calendar',
67-
calendar = d0[calAttr];
66+
var calAttr = axLetter + 'calendar';
67+
var calendar = d0[calAttr];
6868

6969
// check all boxes on this x axis to see
7070
// if they're dates, numbers, or categories
7171
if(isBoxWithoutPositionCoords(d0, axLetter)) {
72-
var posLetter = getBoxPosLetter(d0),
73-
boxPositions = [],
74-
trace;
72+
var posLetter = getBoxPosLetter(d0);
73+
var boxPositions = [];
7574

7675
for(var i = 0; i < data.length; i++) {
77-
trace = data[i];
76+
var trace = data[i];
7877
if(!Registry.traceIs(trace, 'box-violin') ||
7978
(trace[axLetter + 'axis'] || axLetter) !== id) continue;
8079

@@ -87,6 +86,9 @@ function setAutoType(ax, data) {
8786

8887
ax.type = autoType(boxPositions, calendar);
8988
}
89+
else if(d0.type === 'splom') {
90+
ax.type = autoType(d0.dimensions[0].values, calendar);
91+
}
9092
else {
9193
ax.type = autoType(d0[axLetter] || [d0[axLetter + '0']], calendar);
9294
}
@@ -103,6 +105,12 @@ function getFirstNonEmptyTrace(data, id, axLetter) {
103105
else if((trace[axLetter] || []).length || trace[axLetter + '0']) {
104106
return trace;
105107
}
108+
else if(trace.type === 'splom' &&
109+
trace._commonLength > 0 &&
110+
trace[axLetter + 'axes'].indexOf(id) === 0
111+
) {
112+
return trace;
113+
}
106114
}
107115
}
108116
}

0 commit comments

Comments
 (0)