@@ -46,7 +46,7 @@ module.exports = function plot(gd, plotinfo, cdscatter, transitionOpts, makeOnCo
4646 // the z-order of fill layers is correct.
4747 linkTraces ( gd , plotinfo , cdscatter ) ;
4848
49- createFills ( gd , scatterlayer ) ;
49+ createFills ( gd , scatterlayer , plotinfo ) ;
5050
5151 // Sort the traces, once created, so that the ordering is preserved even when traces
5252 // 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
100100 scatterlayer . selectAll ( 'path:not([d])' ) . remove ( ) ;
101101} ;
102102
103- function createFills ( gd , scatterlayer ) {
103+ function createFills ( gd , scatterlayer , plotinfo ) {
104104 var trace ;
105105
106106 scatterlayer . selectAll ( 'g.trace' ) . each ( function ( d ) {
@@ -138,6 +138,10 @@ function createFills(gd, scatterlayer) {
138138 tr . selectAll ( '.js-fill.js-tozero' ) . remove ( ) ;
139139 trace . _ownFill = null ;
140140 }
141+
142+ if ( plotinfo . _hasClipOnAxisFalse ) {
143+ tr . selectAll ( '.js-fill' ) . call ( Drawing . setClipUrl , plotinfo . clipId ) ;
144+ }
141145 } ) ;
142146}
143147
@@ -324,6 +328,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
324328 . call ( Drawing . lineGroupStyle )
325329 . each ( makeUpdate ( true ) ) ;
326330
331+ if ( plotinfo . _hasClipOnAxisFalse ) {
332+ Drawing . setClipUrl ( lineJoin , plotinfo . clipId ) ;
333+ }
334+
327335 if ( segments . length ) {
328336 if ( ownFillEl3 ) {
329337 if ( pt0 && pt1 ) {
@@ -400,7 +408,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
400408 var trace = d [ 0 ] . trace ,
401409 s = d3 . select ( this ) ,
402410 showMarkers = subTypes . hasMarkers ( trace ) ,
403- showText = subTypes . hasText ( trace ) ;
411+ showText = subTypes . hasText ( trace ) ,
412+ hasClipOnAxisFalse = trace . cliponaxis === false ;
404413
405414 var keyFunc = getKeyFunc ( trace ) ,
406415 markerFilter = hideFilter ,
@@ -426,7 +435,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
426435 if ( hasTransition ) {
427436 enter
428437 . call ( Drawing . pointStyle , trace , gd )
429- . call ( Drawing . translatePoints , xa , ya , trace )
438+ . call ( Drawing . translatePoints , xa , ya )
430439 . style ( 'opacity' , 0 )
431440 . transition ( )
432441 . style ( 'opacity' , 1 ) ;
@@ -445,6 +454,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
445454 if ( hasNode ) {
446455 Drawing . singlePointStyle ( d , sel , trace , markerScale , lineScale , gd ) ;
447456
457+ if ( hasClipOnAxisFalse ) {
458+ Drawing . hideOutsideRangePoint ( d , sel , xa , ya ) ;
459+ }
460+
448461 if ( trace . customdata ) {
449462 el . classed ( 'plotly-customdata' , d . data !== null && d . data !== undefined ) ;
450463 }
@@ -475,7 +488,14 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
475488 var g = d3 . select ( this ) ;
476489 var sel = transition ( g . select ( 'text' ) ) ;
477490 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+ }
479499 } ) ;
480500
481501 join . selectAll ( 'text' )
0 commit comments