@@ -678,6 +678,11 @@ function switchToSankeyFormat(nodes) {
678678
679679// scene graph
680680module . 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+ } ) ;
681686
682687 var styledData = calcData
683688 . filter ( function ( d ) { return unwrap ( d ) . trace . visible ; } )
@@ -743,7 +748,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
743748 . attr ( 'd' , linkPath ( ) ) ;
744749
745750 sankeyLink
746- . style ( 'opacity' , function ( ) { return gd . _context . staticPlot ? 1 : 0 ; } )
751+ . style ( 'opacity' , function ( ) { return ( gd . _context . staticPlot || firstRender ) ? 1 : 0 ; } )
747752 . transition ( )
748753 . ease ( c . ease ) . duration ( c . duration )
749754 . style ( 'opacity' , 1 ) ;
@@ -782,7 +787,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
782787 . append ( 'g' )
783788 . classed ( c . cn . sankeyNode , true )
784789 . 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 ; } ) ;
786791
787792 sankeyNode
788793 . call ( attachPointerEvents , sankey , callbacks . nodeEvents )
0 commit comments