@@ -387,64 +387,74 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
387
387
}
388
388
}
389
389
390
+ function hideFilter ( ) {
391
+ return false ;
392
+ }
393
+
390
394
function makePoints ( d ) {
391
395
var join , selection ;
396
+
392
397
var trace = d [ 0 ] . trace ,
393
398
s = d3 . select ( this ) ,
394
399
showMarkers = subTypes . hasMarkers ( trace ) ,
395
400
showText = subTypes . hasText ( trace ) ;
396
401
397
- if ( ( ! showMarkers && ! showText ) || trace . visible !== true ) s . remove ( ) ;
398
- else {
399
- if ( showMarkers ) {
400
- selection = s . selectAll ( 'path.point' ) ;
402
+ var keyFunc = getKeyFunc ( trace ) ,
403
+ markerFilter = hideFilter ,
404
+ textFilter = hideFilter ;
401
405
402
- join = selection
403
- . data ( trace . marker . maxdisplayed ? visFilter : Lib . identity , getKeyFunc ( trace ) ) ;
406
+ if ( showMarkers ) {
407
+ markerFilter = trace . marker . maxdisplayed ? visFilter : Lib . identity ;
408
+ }
404
409
405
- var enter = join . enter ( ) . append ( 'path' )
406
- . classed ( 'point' , true ) ;
410
+ if ( showText ) {
411
+ textFilter = trace . marker . maxdisplayed ? visFilter : Lib . identity ;
412
+ }
407
413
408
- enter . call ( Drawing . pointStyle , trace )
409
- . call ( Drawing . translatePoints , xa , ya , trace ) ;
414
+ // marker points
410
415
411
- if ( hasTransition ) {
412
- enter . style ( 'opacity' , 0 ) . transition ( )
413
- . style ( 'opacity' , 1 ) ;
414
- }
416
+ selection = s . selectAll ( 'path.point' ) ;
415
417
416
- join . each ( function ( d ) {
417
- var sel = transition ( d3 . select ( this ) ) ;
418
- Drawing . translatePoint ( d , sel , xa , ya ) ;
419
- Drawing . singlePointStyle ( d , sel , trace ) ;
420
- } ) ;
418
+ join = selection . data ( markerFilter , keyFunc ) ;
421
419
422
- if ( hasTransition ) {
423
- join . exit ( ) . transition ( )
424
- . style ( 'opacity' , 0 )
425
- . remove ( ) ;
426
- } else {
427
- join . exit ( ) . remove ( ) ;
428
- }
429
- }
430
- if ( showText ) {
431
- selection = s . selectAll ( 'g' ) ;
420
+ var enter = join . enter ( ) . append ( 'path' )
421
+ . classed ( 'point' , true ) ;
432
422
433
- join = selection
434
- . data ( trace . marker . maxdisplayed ? visFilter : Lib . identity ) ;
423
+ enter . call ( Drawing . pointStyle , trace )
424
+ . call ( Drawing . translatePoints , xa , ya , trace ) ;
435
425
436
- // each text needs to go in its own 'g' in case
437
- // it gets converted to mathjax
438
- join . enter ( ) . append ( 'g' )
439
- . append ( 'text' )
440
- . call ( Drawing . translatePoints , xa , ya ) ;
426
+ if ( hasTransition ) {
427
+ enter . style ( 'opacity' , 0 ) . transition ( )
428
+ . style ( 'opacity' , 1 ) ;
429
+ }
441
430
442
- selection
443
- . call ( Drawing . translatePoints , xa , ya ) ;
431
+ join . each ( function ( d ) {
432
+ var sel = transition ( d3 . select ( this ) ) ;
433
+ Drawing . translatePoint ( d , sel , xa , ya ) ;
434
+ Drawing . singlePointStyle ( d , sel , trace ) ;
435
+ } ) ;
444
436
445
- join . exit ( ) . remove ( ) ;
446
- }
437
+ if ( hasTransition ) {
438
+ join . exit ( ) . transition ( )
439
+ . style ( 'opacity' , 0 )
440
+ . remove ( ) ;
441
+ } else {
442
+ join . exit ( ) . remove ( ) ;
447
443
}
444
+
445
+ // text points
446
+
447
+ selection = s . selectAll ( 'g' ) ;
448
+
449
+ join = selection . data ( textFilter , keyFunc ) ;
450
+
451
+ // each text needs to go in its own 'g' in case
452
+ // it gets converted to mathjax
453
+ join . enter ( ) . append ( 'g' )
454
+ . append ( 'text' )
455
+ . call ( Drawing . translatePoints , xa , ya ) ;
456
+
457
+ join . exit ( ) . remove ( ) ;
448
458
}
449
459
450
460
// NB: selectAll is evaluated on instantiation:
0 commit comments