File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -518,9 +518,18 @@ modeBarButtons.resetSankeyGroup = {
518518 title : function ( gd ) { return _ ( gd , 'Ungroup all nodes' ) ; } ,
519519 icon : Icons . home ,
520520 click : function ( gd ) {
521- Registry . call ( 'restyle' , gd , {
522- 'node.groups' : [ [ ] ] ,
523- } ) ;
521+ var aObj = {
522+ 'node.groups' : [ ] ,
523+ 'node.x' : [ ] ,
524+ 'node.y' : [ ]
525+ } ;
526+ for ( var i = 0 ; i < gd . _fullData . length ; i ++ ) {
527+ var viewInitial = gd . _fullData [ i ] . _viewInitial ;
528+ aObj [ 'node.groups' ] . push ( viewInitial . node . groups . slice ( ) ) ;
529+ aObj [ 'node.x' ] . push ( viewInitial . node . x . slice ( ) ) ;
530+ aObj [ 'node.y' ] . push ( viewInitial . node . y . slice ( ) ) ;
531+ }
532+ Registry . call ( 'restyle' , gd , aObj ) ;
524533 }
525534} ;
526535
Original file line number Diff line number Diff line change @@ -127,6 +127,20 @@ module.exports = function plot(gd, calcData) {
127127 var svg = fullLayout . _paper ;
128128 var size = fullLayout . _size ;
129129
130+ // stash initial view
131+ for ( var i = 0 ; i < calcData . length ; i ++ ) {
132+ if ( ! gd . _fullData [ i ] . _viewInitial ) {
133+ var node = gd . _fullData [ i ] . node ;
134+ gd . _fullData [ i ] . _viewInitial = {
135+ node : {
136+ groups : node . groups . slice ( ) ,
137+ x : node . x . slice ( ) ,
138+ y : node . y . slice ( )
139+ }
140+ } ;
141+ }
142+ }
143+
130144 var linkSelect = function ( element , d ) {
131145 var evt = d . link ;
132146 evt . originalEvent = d3 . event ;
You can’t perform that action at this time.
0 commit comments