@@ -57,8 +57,8 @@ var numericNameWarningCountLimit = 5;
5757 *
5858 */
5959function _doPlot ( gd , data , layout , config ) {
60- const isForceRerender = window . isForceRerender
61- window . isForceRerender = false ;
60+ const isForceRerender = window [ `plotly- ${ gd . dataset . chartId } ` ] . isForceRerender
61+ window [ `plotly- ${ gd . dataset . chartId } ` ] . isForceRerender = false ;
6262
6363 var frames ;
6464
@@ -330,9 +330,10 @@ function _doPlot(gd, data, layout, config) {
330330
331331 subroutines . doAutoRangeAndConstraints ( gd ) ;
332332
333+ // !!! We don't need to save an initial range because we change it if we apply a detection time.
333334 // store initial ranges *after* enforcing constraints, otherwise
334335 // we will never look like we're at the initial ranges
335- if ( graphWasEmpty ) Axes . saveRangeInitial ( gd ) ;
336+ // if(graphWasEmpty) Axes.saveRangeInitial(gd);
336337
337338 // this one is different from shapes/annotations calcAutorange
338339 // the others incorporate those components into ax._extremes,
@@ -365,7 +366,8 @@ function _doPlot(gd, data, layout, config) {
365366 gd . _fullLayout . _insideTickLabelsUpdaterange = undefined ;
366367
367368 return relayout ( gd , insideTickLabelsUpdaterange ) . then ( function ( ) {
368- Axes . saveRangeInitial ( gd , true ) ;
369+ // !!! We don't need to save an initial range because we change it if we apply a detection time.
370+ // Axes.saveRangeInitial(gd, true);
369371 } ) ;
370372 }
371373 }
@@ -552,6 +554,8 @@ function redraw(gd) {
552554 } ) ;
553555}
554556
557+ const generateId = ( ) => Math . random ( ) . toString ( 36 ) . substr ( 2 , 10 ) ;
558+
555559/**
556560 * Convenience function to make idempotent plot option obvious to users.
557561 *
@@ -561,7 +565,9 @@ function redraw(gd) {
561565 * @param {Object } config
562566 */
563567function newPlot ( gd , data , layout , config ) {
568+ gd . dataset . chartId = generateId ( )
564569 gd = Lib . getGraphDiv ( gd ) ;
570+ window [ `plotly-${ gd . dataset . chartId } ` ] = { }
565571
566572 // remove gl contexts
567573 Plots . cleanPlot ( [ ] , { } , gd . _fullData || [ ] , gd . _fullLayout || { } ) ;
@@ -2635,7 +2641,9 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
26352641 * object containing `data`, `layout`, `config`, and `frames` members
26362642 *
26372643 */
2638- function react ( gd , data , layout , config , isForce ) {
2644+ function react ( gd , data , layout , config , isForce , xAxisRange ) {
2645+ window [ `plotly-${ gd . dataset . chartId } ` ] . xAxisRange = xAxisRange ;
2646+
26392647 var frames , plotDone ;
26402648
26412649 function addFrames ( ) { return exports . addFrames ( gd , frames ) ; }
@@ -2744,7 +2752,7 @@ function react(gd, data, layout, config, isForce) {
27442752 } ) ;
27452753 } else if ( isForce || restyleFlags . fullReplot || relayoutFlags . layoutReplot || configChanged ) {
27462754 gd . _fullLayout . _skipDefaults = true ;
2747- window . isForceRerender = true
2755+ window [ `plotly- ${ gd . dataset . chartId } ` ] . isForceRerender = true
27482756 seq . push ( exports . _doPlot ) ;
27492757 } else {
27502758 for ( var componentType in relayoutFlags . arrays ) {
0 commit comments