@@ -269,7 +269,7 @@ exports.plot = function(gd, data, layout, config) {
269269 Lib . error ( msg ) ;
270270 } else {
271271 Lib . log ( msg + ' Clearing graph and plotting again.' ) ;
272- Plots . cleanPlot ( [ ] , { } , gd . _fullData , fullLayout , gd . calcdata ) ;
272+ Plots . cleanPlot ( [ ] , { } , gd . _fullData , fullLayout ) ;
273273 Plots . supplyDefaults ( gd ) ;
274274 fullLayout = gd . _fullLayout ;
275275 Plots . doCalcdata ( gd ) ;
@@ -614,7 +614,7 @@ exports.newPlot = function(gd, data, layout, config) {
614614 gd = Lib . getGraphDiv ( gd ) ;
615615
616616 // remove gl contexts
617- Plots . cleanPlot ( [ ] , { } , gd . _fullData || [ ] , gd . _fullLayout || { } , gd . calcdata || [ ] ) ;
617+ Plots . cleanPlot ( [ ] , { } , gd . _fullData || [ ] , gd . _fullLayout || { } ) ;
618618
619619 Plots . purge ( gd ) ;
620620 return exports . plot ( gd , data , layout , config ) ;
@@ -1344,8 +1344,21 @@ exports.restyle = function restyle(gd, astr, val, _traces) {
13441344 } else {
13451345 seq . push ( Plots . previousPromises ) ;
13461346
1347+ // maybe only call Plots.supplyDataDefaults in the splom case,
1348+ // to skip over long and slow axes defaults
13471349 Plots . supplyDefaults ( gd ) ;
13481350
1351+ if ( flags . markerSize ) {
1352+ Plots . doCalcdata ( gd ) ;
1353+ addAxRangeSequence ( seq ) ;
1354+
1355+ // TODO
1356+ // if all axes have autorange:false, then
1357+ // proceed to subroutines.doTraceStyle(),
1358+ // otherwise we must go through addAxRangeSequence,
1359+ // which in general must redraws 'all' axes
1360+ }
1361+
13491362 if ( flags . style ) seq . push ( subroutines . doTraceStyle ) ;
13501363 if ( flags . colorbars ) seq . push ( subroutines . doColorBars ) ;
13511364
@@ -1595,8 +1608,10 @@ function _restyle(gd, aobj, traces) {
15951608 else {
15961609 if ( valObject ) {
15971610 // must redo calcdata when restyling array values of arrayOk attributes
1598- if ( valObject . arrayOk && (
1599- Lib . isArrayOrTypedArray ( newVal ) || Lib . isArrayOrTypedArray ( oldVal ) )
1611+ // ... but no need to this for regl-based traces
1612+ if ( valObject . arrayOk &&
1613+ ! Registry . traceIs ( contFull , 'regl' ) &&
1614+ ( Lib . isArrayOrTypedArray ( newVal ) || Lib . isArrayOrTypedArray ( oldVal ) )
16001615 ) {
16011616 flags . calc = true ;
16021617 }
@@ -1724,15 +1739,11 @@ exports.relayout = function relayout(gd, astr, val) {
17241739 seq . push ( subroutines . layoutReplot ) ;
17251740 }
17261741 else if ( Object . keys ( aobj ) . length ) {
1727- Plots . supplyDefaults ( gd ) ;
1742+ axRangeSupplyDefaultsByPass ( gd , flags , specs ) || Plots . supplyDefaults ( gd ) ;
17281743
17291744 if ( flags . legend ) seq . push ( subroutines . doLegend ) ;
17301745 if ( flags . layoutstyle ) seq . push ( subroutines . layoutStyles ) ;
1731-
1732- if ( flags . axrange ) {
1733- addAxRangeSequence ( seq , specs . rangesAltered ) ;
1734- }
1735-
1746+ if ( flags . axrange ) addAxRangeSequence ( seq , specs . rangesAltered ) ;
17361747 if ( flags . ticks ) seq . push ( subroutines . doTicksRelayout ) ;
17371748 if ( flags . modebar ) seq . push ( subroutines . doModeBar ) ;
17381749 if ( flags . camera ) seq . push ( subroutines . doCamera ) ;
@@ -1756,13 +1767,35 @@ exports.relayout = function relayout(gd, astr, val) {
17561767 } ) ;
17571768} ;
17581769
1770+ // Optimization mostly for large splom traces where
1771+ // Plots.supplyDefaults can take > 100ms
1772+ function axRangeSupplyDefaultsByPass ( gd , flags , specs ) {
1773+ var k ;
1774+
1775+ if ( ! flags . axrange ) return false ;
1776+
1777+ for ( k in flags ) {
1778+ if ( k !== 'axrange' && flags [ k ] ) return false ;
1779+ }
1780+
1781+ for ( k in specs . rangesAltered ) {
1782+ var axName = Axes . id2name ( k ) ;
1783+ var axIn = gd . layout [ axName ] ;
1784+ var axOut = gd . _fullLayout [ axName ] ;
1785+ axOut . autorange = axIn . autorange ;
1786+ axOut . range = axIn . range . slice ( ) ;
1787+ axOut . cleanRange ( ) ;
1788+ }
1789+ return true ;
1790+ }
1791+
17591792function addAxRangeSequence ( seq , rangesAltered ) {
17601793 // N.B. leave as sequence of subroutines (for now) instead of
17611794 // subroutine of its own so that finalDraw always gets
17621795 // executed after drawData
17631796 var doTicks = rangesAltered ?
1764- function ( gd ) { return subroutines . doTicksRelayout ( gd , rangesAltered ) ; } :
1765- subroutines . doTicksRelayout ;
1797+ function ( gd ) { return Axes . doTicks ( gd , Object . keys ( rangesAltered ) , true ) ; } :
1798+ function ( gd ) { return Axes . doTicks ( gd , 'redraw' ) ; } ;
17661799
17671800 seq . push (
17681801 subroutines . doAutoRangeAndConstraints ,
@@ -2179,15 +2212,13 @@ exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) {
21792212 }
21802213 else {
21812214 seq . push ( Plots . previousPromises ) ;
2182- Plots . supplyDefaults ( gd ) ;
2215+ axRangeSupplyDefaultsByPass ( gd , relayoutFlags , relayoutSpecs ) || Plots . supplyDefaults ( gd ) ;
21832216
21842217 if ( restyleFlags . style ) seq . push ( subroutines . doTraceStyle ) ;
21852218 if ( restyleFlags . colorbars ) seq . push ( subroutines . doColorBars ) ;
21862219 if ( relayoutFlags . legend ) seq . push ( subroutines . doLegend ) ;
21872220 if ( relayoutFlags . layoutstyle ) seq . push ( subroutines . layoutStyles ) ;
2188- if ( relayoutFlags . axrange ) {
2189- addAxRangeSequence ( seq , relayoutSpecs . rangesAltered ) ;
2190- }
2221+ if ( relayoutFlags . axrange ) addAxRangeSequence ( seq , relayoutSpecs . rangesAltered ) ;
21912222 if ( relayoutFlags . ticks ) seq . push ( subroutines . doTicksRelayout ) ;
21922223 if ( relayoutFlags . modebar ) seq . push ( subroutines . doModeBar ) ;
21932224 if ( relayoutFlags . camera ) seq . push ( subroutines . doCamera ) ;
@@ -3191,10 +3222,9 @@ exports.purge = function purge(gd) {
31913222
31923223 var fullLayout = gd . _fullLayout || { } ;
31933224 var fullData = gd . _fullData || [ ] ;
3194- var calcdata = gd . calcdata || [ ] ;
31953225
31963226 // remove gl contexts
3197- Plots . cleanPlot ( [ ] , { } , fullData , fullLayout , calcdata ) ;
3227+ Plots . cleanPlot ( [ ] , { } , fullData , fullLayout ) ;
31983228
31993229 // purge properties
32003230 Plots . purge ( gd ) ;
0 commit comments