Skip to content

Commit 00cae48

Browse files
committed
Revert "clear axis types when restyling splom show(upper|lower)half"
This reverts commit 078c086.
1 parent 078c086 commit 00cae48

File tree

3 files changed

+19
-69
lines changed

3 files changed

+19
-69
lines changed

src/plot_api/helpers.js

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var Plots = require('../plots/plots');
1818
var AxisIds = require('../plots/cartesian/axis_ids');
1919
var cleanId = AxisIds.cleanId;
2020
var getFromTrace = AxisIds.getFromTrace;
21-
var id2name = AxisIds.id2name;
2221
var Color = require('../components/color');
2322

2423

@@ -571,35 +570,25 @@ exports.hasParent = function(aobj, attr) {
571570
* @param {object} layoutUpdate: any update being done concurrently to the layout,
572571
* which may supercede clearing the axis types
573572
*/
574-
var xy = ['x', 'y'];
575-
var xyz = ['x', 'y', 'z'];
573+
var axLetters = ['x', 'y', 'z'];
576574
exports.clearAxisTypes = function(gd, traces, layoutUpdate) {
577575
for(var i = 0; i < traces.length; i++) {
578576
var trace = gd._fullData[i];
579-
var letters = Registry.traceIs(trace, 'gl3d') ? xyz : xy;
580-
581-
for(var j = 0; j < letters.length; j++) {
582-
var l = letters[j];
583-
var axes = trace.type === 'splom' ?
584-
trace[l + 'axes'].map(function(id) { return gd._fullLayout[id2name(id)]; }) :
585-
[getFromTrace(gd, trace, l)];
586-
587-
for(var k = 0; k < axes.length; k++) {
588-
var ax = axes[k];
589-
590-
// do not clear log type - that's never an auto result so must have been intentional
591-
if(ax && ax.type !== 'log') {
592-
var axAttr = ax._name;
593-
var sceneName = ax._id.substr(1);
594-
if(sceneName.substr(0, 5) === 'scene') {
595-
if(layoutUpdate[sceneName] !== undefined) continue;
596-
axAttr = sceneName + '.' + axAttr;
597-
}
598-
var typeAttr = axAttr + '.type';
599-
600-
if(layoutUpdate[axAttr] === undefined && layoutUpdate[typeAttr] === undefined) {
601-
Lib.nestedProperty(gd.layout, typeAttr).set(null);
602-
}
577+
for(var j = 0; j < 3; j++) {
578+
var ax = getFromTrace(gd, trace, axLetters[j]);
579+
580+
// do not clear log type - that's never an auto result so must have been intentional
581+
if(ax && ax.type !== 'log') {
582+
var axAttr = ax._name;
583+
var sceneName = ax._id.substr(1);
584+
if(sceneName.substr(0, 5) === 'scene') {
585+
if(layoutUpdate[sceneName] !== undefined) continue;
586+
axAttr = sceneName + '.' + axAttr;
587+
}
588+
var typeAttr = axAttr + '.type';
589+
590+
if(layoutUpdate[axAttr] === undefined && layoutUpdate[typeAttr] === undefined) {
591+
Lib.nestedProperty(gd.layout, typeAttr).set(null);
603592
}
604593
}
605594
}

src/traces/splom/attributes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ module.exports = {
125125
valType: 'boolean',
126126
role: 'info',
127127
dflt: true,
128-
editType: 'calc+clearAxisTypes',
128+
editType: 'calc',
129129
description: [
130130
'Determines whether or not subplots on the diagonal are displayed.'
131131
].join(' ')
@@ -142,7 +142,7 @@ module.exports = {
142142
valType: 'boolean',
143143
role: 'info',
144144
dflt: true,
145-
editType: 'calc+clearAxisTypes',
145+
editType: 'calc',
146146
description: [
147147
'Determines whether or not subplots on the upper half',
148148
'from the diagonal are displayed.'
@@ -152,7 +152,7 @@ module.exports = {
152152
valType: 'boolean',
153153
role: 'info',
154154
dflt: true,
155-
editType: 'calc+clearAxisTypes',
155+
editType: 'calc',
156156
description: [
157157
'Determines whether or not subplots on the lower half',
158158
'from the diagonal are displayed.'

test/jasmine/tests/splom_test.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -774,45 +774,6 @@ describe('Test splom interactions:', function() {
774774
.catch(failTest)
775775
.then(done);
776776
});
777-
778-
it('@gl should clear axis auto-types when changing subplot arrangement', function(done) {
779-
var data = [{
780-
type: 'splom',
781-
showupperhalf: false,
782-
diagonal: {visible: false},
783-
dimensions: [{
784-
values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
785-
}, {
786-
values: ['lyndon', 'richard', 'gerald', 'jimmy', 'ronald', 'george', 'bill', 'georgeW', 'barack', 'donald']
787-
}, {
788-
values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
789-
}]
790-
}];
791-
792-
Plotly.plot(gd, data).then(function() {
793-
expect(gd.layout.xaxis.type).toBe('linear');
794-
expect(gd.layout.xaxis2.type).toBe('category');
795-
expect(gd.layout.xaxis3).toBeUndefined();
796-
expect(gd.layout.yaxis.type).toBe('category');
797-
expect(gd.layout.yaxis2.type).toBe('linear');
798-
expect(gd.layout.yaxis3).toBeUndefined();
799-
800-
return Plotly.restyle(gd, {
801-
'showupperhalf': true,
802-
'diagonal.visible': true
803-
});
804-
})
805-
.then(function() {
806-
expect(gd.layout.xaxis.type).toBe('linear');
807-
expect(gd.layout.xaxis2.type).toBe('category');
808-
expect(gd.layout.xaxis3.type).toBe('linear');
809-
expect(gd.layout.yaxis.type).toBe('linear');
810-
expect(gd.layout.yaxis2.type).toBe('category');
811-
expect(gd.layout.yaxis3.type).toBe('linear');
812-
})
813-
.catch(failTest)
814-
.then(done);
815-
});
816777
});
817778

818779
describe('Test splom update switchboard:', function() {

0 commit comments

Comments
 (0)