Skip to content

Commit c290adf

Browse files
committed
add axis.matches boolean to splom dims
- defaults to `false`, when set to `true`, the generated splom axes will match
1 parent d9c2d4e commit c290adf

File tree

8 files changed

+1535
-6
lines changed

8 files changed

+1535
-6
lines changed

src/plots/cartesian/constraints.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var FROM_BL = require('../../constants/alignment').FROM_BL;
2020
exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, allAxisIds, layoutOut) {
2121
var constraintGroups = layoutOut._axisConstraintGroups;
2222
var matchGroups = layoutOut._axisMatchGroups;
23+
var axId = containerOut._id;
24+
var axLetter = axId.charAt(0);
25+
var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {};
2326
var thisID = containerOut._id;
2427
var letter = thisID.charAt(0);
2528

@@ -36,7 +39,7 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
3639
}
3740
}, 'constraintoward');
3841

39-
if(!containerIn.scaleanchor && !containerIn.matches) return;
42+
if(!containerIn.scaleanchor && !containerIn.matches && !splomStash.matches) return;
4043

4144
var opts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut);
4245

@@ -50,7 +53,8 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
5053
var matches = Lib.coerce(containerIn, containerOut, {
5154
matches: {
5255
valType: 'enumerated',
53-
values: opts.linkableAxes
56+
values: opts.linkableAxes,
57+
dflt: splomStash.matches
5458
}
5559
}, 'matches');
5660

src/traces/splom/attributes.js

+14
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ module.exports = {
100100
].join(' ')
101101
},
102102

103+
// TODO make 'true' the default in v2?
104+
matches: {
105+
valType: 'boolean',
106+
dflt: false,
107+
role: 'info',
108+
editType: 'calc',
109+
description: [
110+
'Determines whether or not the x & y axes generated by this',
111+
'dimension match.',
112+
'Equivalent to setting the `matches` axis attribute in the layout',
113+
'with the correct axis id.'
114+
].join(' ')
115+
},
116+
103117
editType: 'calc+clearAxisTypes'
104118
},
105119

src/traces/splom/defaults.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function dimensionDefaults(dimIn, dimOut) {
6363
else coerce('visible');
6464

6565
coerce('axis.type');
66+
coerce('axis.matches');
6667
}
6768

6869
function handleAxisDefaults(traceIn, traceOut, layout, coerce) {
@@ -97,7 +98,7 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) {
9798
var xList = [];
9899
var yList = [];
99100

100-
function fillAxisStashes(axId, dim, list) {
101+
function fillAxisStashes(axId, counterAxId, dim, list) {
101102
if(!axId) return;
102103

103104
var axLetter = axId.charAt(0);
@@ -111,7 +112,8 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) {
111112
if(dim) {
112113
s.label = dim.label || '';
113114
if(dim.visible && dim.axis) {
114-
s.type = dim.axis.type;
115+
if(dim.axis.type) s.type = dim.axis.type;
116+
if(dim.axis.matches) s.matches = counterAxId;
115117
}
116118
}
117119
}
@@ -136,8 +138,8 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) {
136138
undefined :
137139
yaxes[i];
138140

139-
fillAxisStashes(xaId, dim, xList);
140-
fillAxisStashes(yaId, dim, yList);
141+
fillAxisStashes(xaId, yaId, dim, xList);
142+
fillAxisStashes(yaId, xaId, dim, yList);
141143
diag[i] = [xaId, yaId];
142144
}
143145

66.5 KB
Loading
Loading

0 commit comments

Comments
 (0)