File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,7 @@ TraceManager.prototype.updateFilter = function(group, keys) {
488
488
489
489
} else {
490
490
491
+ var traces = [ ] ;
491
492
for ( var i = 0 ; i < this . origData . length ; i ++ ) {
492
493
var trace = this . origData [ i ] ;
493
494
if ( ! trace . key || trace . set !== group ) {
@@ -496,18 +497,17 @@ TraceManager.prototype.updateFilter = function(group, keys) {
496
497
var matchFunc = getMatchFunc ( trace ) ;
497
498
var matches = matchFunc ( trace . key , keys ) ;
498
499
499
- if ( matches . length == 0 ) {
500
- this . gd . data [ i ] = undefined ;
501
- }
502
- if ( ! trace . _isSimpleKey ) {
503
- // subsetArrayAttrs doesn't mutate trace (it makes a modified clone)
504
- this . gd . data [ i ] = subsetArrayAttrs ( trace , matches ) ;
500
+ if ( matches . length > 0 ) {
501
+ if ( ! trace . _isSimpleKey ) {
502
+ // subsetArrayAttrs doesn't mutate trace (it makes a modified clone)
503
+ trace = subsetArrayAttrs ( trace , matches ) ;
504
+ }
505
+ traces . push ( trace ) ;
505
506
}
506
507
}
507
-
508
508
}
509
509
510
- this . gd . data = this . gd . data . filter ( function ( tr ) { return tr !== undefined ; } ) ;
510
+ this . gd . data = traces ;
511
511
Plotly . redraw ( this . gd ) ;
512
512
513
513
// NOTE: we purposely do _not_ restore selection(s), since on filter,
You can’t perform that action at this time.
0 commit comments