@@ -678,6 +678,11 @@ function switchToSankeyFormat(nodes) {
678
678
679
679
// scene graph
680
680
module . exports = function ( gd , svg , calcData , layout , callbacks ) {
681
+ // To prevent animation on first render
682
+ var firstRender = false ;
683
+ Lib . ensureSingle ( gd . _fullLayout . _infolayer , 'g' , 'first-render' , function ( ) {
684
+ firstRender = true ;
685
+ } ) ;
681
686
682
687
var styledData = calcData
683
688
. filter ( function ( d ) { return unwrap ( d ) . trace . visible ; } )
@@ -743,7 +748,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
743
748
. attr ( 'd' , linkPath ( ) ) ;
744
749
745
750
sankeyLink
746
- . style ( 'opacity' , function ( ) { return gd . _context . staticPlot ? 1 : 0 ; } )
751
+ . style ( 'opacity' , function ( ) { return ( gd . _context . staticPlot || firstRender ) ? 1 : 0 ; } )
747
752
. transition ( )
748
753
. ease ( c . ease ) . duration ( c . duration )
749
754
. style ( 'opacity' , 1 ) ;
@@ -782,7 +787,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
782
787
. append ( 'g' )
783
788
. classed ( c . cn . sankeyNode , true )
784
789
. call ( updateNodePositions )
785
- . style ( 'opacity' , function ( n ) { return ( gd . _context . staticPlot && ! n . partOfGroup ) ? 1 : 0 ; } ) ;
790
+ . style ( 'opacity' , function ( n ) { return ( ( gd . _context . staticPlot || firstRender ) && ! n . partOfGroup ) ? 1 : 0 ; } ) ;
786
791
787
792
sankeyNode
788
793
. call ( attachPointerEvents , sankey , callbacks . nodeEvents )
0 commit comments