Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-axis-type sploms #2899

Merged
merged 13 commits into from
Aug 15, 2018
3 changes: 2 additions & 1 deletion src/plots/cartesian/type_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ function setAutoType(ax, data) {
}
else if(d0.type === 'splom') {
var dimensions = d0.dimensions;
var diag = d0._diag;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recall that _diag is:

// build list of [x,y] axis corresponding to each dimensions[i],
// very useful for passing options to regl-splom
var diag = traceOut._diag = new Array(dimLength);
// cases where showDiag and showLower or showUpper are false
// no special treatment as the xaxes and yaxes items no longer match
// the dimensions items 1-to-1
var xShift = !showDiag && !showLower ? -1 : 0;
var yShift = !showDiag && !showUpper ? -1 : 0;
for(i = 0; i < dimLength; i++) {
var dim = dimensions[i];
var xa = xaxes[i + xShift];
var ya = yaxes[i + yShift];
fillAxisStash(layout, xa, dim);
fillAxisStash(layout, ya, dim);
// note that some the entries here may be undefined
diag[i] = [xa, ya];
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok - a little confusing as usually xa is a full axis object, an id would be xId or something... but anyway nice fix!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned up in -> f3c73db

for(i = 0; i < dimensions.length; i++) {
var dim = dimensions[i];
if(dim.visible) {
if(dim.visible && (diag[i][0] === id || diag[i][1] === id)) {
ax.type = autoType(dim.values, calendar);
break;
}
Expand Down
6 changes: 4 additions & 2 deletions test/jasmine/tests/splom_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,10 @@ describe('Test splom trace defaults:', function() {
});

var fullLayout = gd._fullLayout;
expect(fullLayout.xaxis.type).toBe('date');
expect(fullLayout.yaxis.type).toBe('date');
expect(fullLayout.xaxis.type).toBe('linear', 'fallbacks to linear for visible:false traces');
expect(fullLayout.yaxis.type).toBe('linear', 'fallbacks to linear for visible:false traces');
expect(fullLayout.xaxis2.type).toBe('date');
expect(fullLayout.yaxis2.type).toBe('date');
});
});

Expand Down