@@ -46,7 +46,7 @@ module.exports = function plot(gd, plotinfo, cdscatter, transitionOpts, makeOnCo
46
46
// the z-order of fill layers is correct.
47
47
linkTraces ( gd , plotinfo , cdscatter ) ;
48
48
49
- createFills ( gd , scatterlayer ) ;
49
+ createFills ( gd , scatterlayer , plotinfo ) ;
50
50
51
51
// Sort the traces, once created, so that the ordering is preserved even when traces
52
52
// are shown and hidden. This is needed since we're not just wiping everything out
@@ -100,7 +100,7 @@ module.exports = function plot(gd, plotinfo, cdscatter, transitionOpts, makeOnCo
100
100
scatterlayer . selectAll ( 'path:not([d])' ) . remove ( ) ;
101
101
} ;
102
102
103
- function createFills ( gd , scatterlayer ) {
103
+ function createFills ( gd , scatterlayer , plotinfo ) {
104
104
var trace ;
105
105
106
106
scatterlayer . selectAll ( 'g.trace' ) . each ( function ( d ) {
@@ -138,6 +138,10 @@ function createFills(gd, scatterlayer) {
138
138
tr . selectAll ( '.js-fill.js-tozero' ) . remove ( ) ;
139
139
trace . _ownFill = null ;
140
140
}
141
+
142
+ if ( plotinfo . _hasClipOnAxisFalse ) {
143
+ tr . selectAll ( '.js-fill' ) . call ( Drawing . setClipUrl , plotinfo . clipId ) ;
144
+ }
141
145
} ) ;
142
146
}
143
147
@@ -324,6 +328,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
324
328
. call ( Drawing . lineGroupStyle )
325
329
. each ( makeUpdate ( true ) ) ;
326
330
331
+ if ( plotinfo . _hasClipOnAxisFalse ) {
332
+ Drawing . setClipUrl ( lineJoin , plotinfo . clipId ) ;
333
+ }
334
+
327
335
if ( segments . length ) {
328
336
if ( ownFillEl3 ) {
329
337
if ( pt0 && pt1 ) {
@@ -400,7 +408,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
400
408
var trace = d [ 0 ] . trace ,
401
409
s = d3 . select ( this ) ,
402
410
showMarkers = subTypes . hasMarkers ( trace ) ,
403
- showText = subTypes . hasText ( trace ) ;
411
+ showText = subTypes . hasText ( trace ) ,
412
+ hasClipOnAxisFalse = trace . cliponaxis === false ;
404
413
405
414
var keyFunc = getKeyFunc ( trace ) ,
406
415
markerFilter = hideFilter ,
@@ -426,7 +435,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
426
435
if ( hasTransition ) {
427
436
enter
428
437
. call ( Drawing . pointStyle , trace , gd )
429
- . call ( Drawing . translatePoints , xa , ya , trace )
438
+ . call ( Drawing . translatePoints , xa , ya )
430
439
. style ( 'opacity' , 0 )
431
440
. transition ( )
432
441
. style ( 'opacity' , 1 ) ;
@@ -445,6 +454,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
445
454
if ( hasNode ) {
446
455
Drawing . singlePointStyle ( d , sel , trace , markerScale , lineScale , gd ) ;
447
456
457
+ if ( hasClipOnAxisFalse ) {
458
+ Drawing . hideOutsideRangePoint ( d , sel , xa , ya ) ;
459
+ }
460
+
448
461
if ( trace . customdata ) {
449
462
el . classed ( 'plotly-customdata' , d . data !== null && d . data !== undefined ) ;
450
463
}
@@ -475,7 +488,14 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
475
488
var g = d3 . select ( this ) ;
476
489
var sel = transition ( g . select ( 'text' ) ) ;
477
490
hasNode = Drawing . translatePoint ( d , sel , xa , ya ) ;
478
- if ( ! hasNode ) g . remove ( ) ;
491
+
492
+ if ( hasNode ) {
493
+ if ( hasClipOnAxisFalse ) {
494
+ Drawing . hideOutsideRangePoint ( d , g , xa , ya ) ;
495
+ }
496
+ } else {
497
+ g . remove ( ) ;
498
+ }
479
499
} ) ;
480
500
481
501
join . selectAll ( 'text' )
0 commit comments