@@ -269,7 +269,7 @@ exports.plot = function(gd, data, layout, config) {
269
269
Lib . error ( msg ) ;
270
270
} else {
271
271
Lib . log ( msg + ' Clearing graph and plotting again.' ) ;
272
- Plots . cleanPlot ( [ ] , { } , gd . _fullData , fullLayout , gd . calcdata ) ;
272
+ Plots . cleanPlot ( [ ] , { } , gd . _fullData , fullLayout ) ;
273
273
Plots . supplyDefaults ( gd ) ;
274
274
fullLayout = gd . _fullLayout ;
275
275
Plots . doCalcdata ( gd ) ;
@@ -614,7 +614,7 @@ exports.newPlot = function(gd, data, layout, config) {
614
614
gd = Lib . getGraphDiv ( gd ) ;
615
615
616
616
// remove gl contexts
617
- Plots . cleanPlot ( [ ] , { } , gd . _fullData || [ ] , gd . _fullLayout || { } , gd . calcdata || [ ] ) ;
617
+ Plots . cleanPlot ( [ ] , { } , gd . _fullData || [ ] , gd . _fullLayout || { } ) ;
618
618
619
619
Plots . purge ( gd ) ;
620
620
return exports . plot ( gd , data , layout , config ) ;
@@ -1344,8 +1344,21 @@ exports.restyle = function restyle(gd, astr, val, _traces) {
1344
1344
} else {
1345
1345
seq . push ( Plots . previousPromises ) ;
1346
1346
1347
+ // maybe only call Plots.supplyDataDefaults in the splom case,
1348
+ // to skip over long and slow axes defaults
1347
1349
Plots . supplyDefaults ( gd ) ;
1348
1350
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
+
1349
1362
if ( flags . style ) seq . push ( subroutines . doTraceStyle ) ;
1350
1363
if ( flags . colorbars ) seq . push ( subroutines . doColorBars ) ;
1351
1364
@@ -1595,8 +1608,10 @@ function _restyle(gd, aobj, traces) {
1595
1608
else {
1596
1609
if ( valObject ) {
1597
1610
// 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 ) )
1600
1615
) {
1601
1616
flags . calc = true ;
1602
1617
}
@@ -1724,15 +1739,11 @@ exports.relayout = function relayout(gd, astr, val) {
1724
1739
seq . push ( subroutines . layoutReplot ) ;
1725
1740
}
1726
1741
else if ( Object . keys ( aobj ) . length ) {
1727
- Plots . supplyDefaults ( gd ) ;
1742
+ axRangeSupplyDefaultsByPass ( gd , flags , specs ) || Plots . supplyDefaults ( gd ) ;
1728
1743
1729
1744
if ( flags . legend ) seq . push ( subroutines . doLegend ) ;
1730
1745
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 ) ;
1736
1747
if ( flags . ticks ) seq . push ( subroutines . doTicksRelayout ) ;
1737
1748
if ( flags . modebar ) seq . push ( subroutines . doModeBar ) ;
1738
1749
if ( flags . camera ) seq . push ( subroutines . doCamera ) ;
@@ -1756,13 +1767,35 @@ exports.relayout = function relayout(gd, astr, val) {
1756
1767
} ) ;
1757
1768
} ;
1758
1769
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
+
1759
1792
function addAxRangeSequence ( seq , rangesAltered ) {
1760
1793
// N.B. leave as sequence of subroutines (for now) instead of
1761
1794
// subroutine of its own so that finalDraw always gets
1762
1795
// executed after drawData
1763
1796
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' ) ; } ;
1766
1799
1767
1800
seq . push (
1768
1801
subroutines . doAutoRangeAndConstraints ,
@@ -2179,15 +2212,13 @@ exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) {
2179
2212
}
2180
2213
else {
2181
2214
seq . push ( Plots . previousPromises ) ;
2182
- Plots . supplyDefaults ( gd ) ;
2215
+ axRangeSupplyDefaultsByPass ( gd , relayoutFlags , relayoutSpecs ) || Plots . supplyDefaults ( gd ) ;
2183
2216
2184
2217
if ( restyleFlags . style ) seq . push ( subroutines . doTraceStyle ) ;
2185
2218
if ( restyleFlags . colorbars ) seq . push ( subroutines . doColorBars ) ;
2186
2219
if ( relayoutFlags . legend ) seq . push ( subroutines . doLegend ) ;
2187
2220
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 ) ;
2191
2222
if ( relayoutFlags . ticks ) seq . push ( subroutines . doTicksRelayout ) ;
2192
2223
if ( relayoutFlags . modebar ) seq . push ( subroutines . doModeBar ) ;
2193
2224
if ( relayoutFlags . camera ) seq . push ( subroutines . doCamera ) ;
@@ -3191,10 +3222,9 @@ exports.purge = function purge(gd) {
3191
3222
3192
3223
var fullLayout = gd . _fullLayout || { } ;
3193
3224
var fullData = gd . _fullData || [ ] ;
3194
- var calcdata = gd . calcdata || [ ] ;
3195
3225
3196
3226
// remove gl contexts
3197
- Plots . cleanPlot ( [ ] , { } , fullData , fullLayout , calcdata ) ;
3227
+ Plots . cleanPlot ( [ ] , { } , fullData , fullLayout ) ;
3198
3228
3199
3229
// purge properties
3200
3230
Plots . purge ( gd ) ;
0 commit comments