Skip to content

Commit 17e30d2

Browse files
committedSep 28, 2018
aggressively try to speed 'axrange' edits for splom
... by passing Plots.supplyDefaults which can take more than 100ms for large splom traces (because of all those axes to coerce). - N.B. this commit applies to optimization to all 'axrange', I could make apply only to hasOnlyLargeSplom graphs if deemed too dangerous.
1 parent cc5f0ca commit 17e30d2

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed
 

‎src/plot_api/plot_api.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -1701,15 +1701,26 @@ exports.relayout = function relayout(gd, astr, val) {
17011701
seq.push(subroutines.layoutReplot);
17021702
}
17031703
else if(Object.keys(aobj).length) {
1704-
Plots.supplyDefaults(gd);
1704+
var flagList = Object.keys(flags).filter(function(k) { return flags[k]; });
1705+
1706+
// Optimization mostly for large splom traces where
1707+
// Plots.supplyDefaults can take > 100ms
1708+
if(flagList[0] === 'axrange' && flagList.length === 1) {
1709+
for(var k in specs.rangesAltered) {
1710+
var axName = Axes.id2name(k);
1711+
var axIn = gd.layout[axName];
1712+
var axOut = gd._fullLayout[axName];
1713+
axOut.autorange = axIn.autorange;
1714+
axOut.range = axIn.range.slice();
1715+
axOut.cleanRange();
1716+
}
1717+
} else {
1718+
Plots.supplyDefaults(gd);
1719+
}
17051720

17061721
if(flags.legend) seq.push(subroutines.doLegend);
17071722
if(flags.layoutstyle) seq.push(subroutines.layoutStyles);
1708-
1709-
if(flags.axrange) {
1710-
addAxRangeSequence(seq, specs.rangesAltered);
1711-
}
1712-
1723+
if(flags.axrange) addAxRangeSequence(seq, specs.rangesAltered);
17131724
if(flags.ticks) seq.push(subroutines.doTicksRelayout);
17141725
if(flags.modebar) seq.push(subroutines.doModeBar);
17151726
if(flags.camera) seq.push(subroutines.doCamera);

‎src/plots/polar/layout_attributes.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var radialAxisAttrs = {
5959
visible: extendFlat({}, axesAttrs.visible, {dflt: true}),
6060
type: axesAttrs.type,
6161

62-
autorange: axesAttrs.autorange,
62+
autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}),
6363
rangemode: {
6464
valType: 'enumerated',
6565
values: ['tozero', 'nonnegative', 'normal'],
@@ -75,7 +75,13 @@ var radialAxisAttrs = {
7575
'of the input data (same behavior as for cartesian axes).'
7676
].join(' ')
7777
},
78-
range: axesAttrs.range,
78+
range: extendFlat({}, axesAttrs.range, {
79+
items: [
80+
{valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}},
81+
{valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}}
82+
],
83+
editType: 'plot'
84+
}),
7985

8086
categoryorder: axesAttrs.categoryorder,
8187
categoryarray: axesAttrs.categoryarray,

‎test/jasmine/tests/splom_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ describe('Test splom update switchboard:', function() {
808808
var msg = 'after update';
809809

810810
assertSpies(msg, [
811-
['supplyDefaults', 1],
811+
['supplyDefaults', 0],
812812
['doTicks', 1],
813813
['regl clear', 1],
814814
['splom grid update', 1],

0 commit comments

Comments
 (0)
Please sign in to comment.