@@ -2756,7 +2756,7 @@ function makeCartesianPlotFramwork(gd, subplots) {
27562756 plotinfo . overgrid = plotgroup . append ( 'g' ) ;
27572757 plotinfo . zerolinelayer = plotgroup . append ( 'g' ) ;
27582758 plotinfo . overzero = plotgroup . append ( 'g' ) ;
2759- plotinfo . plot = plotgroup . append ( 'svg ' ) . call ( plotLayers ) ;
2759+ plotinfo . plot = plotgroup . append ( 'g ' ) . call ( plotLayers ) ;
27602760 plotinfo . overplot = plotgroup . append ( 'g' ) ;
27612761 plotinfo . xlines = plotgroup . append ( 'path' ) ;
27622762 plotinfo . ylines = plotgroup . append ( 'path' ) ;
@@ -2782,7 +2782,7 @@ function makeCartesianPlotFramwork(gd, subplots) {
27822782
27832783 plotinfo . gridlayer = mainplot . overgrid . append ( 'g' ) ;
27842784 plotinfo . zerolinelayer = mainplot . overzero . append ( 'g' ) ;
2785- plotinfo . plot = mainplot . overplot . append ( 'svg ' ) . call ( plotLayers ) ;
2785+ plotinfo . plot = mainplot . overplot . append ( 'g ' ) . call ( plotLayers ) ;
27862786 plotinfo . xlines = mainplot . overlines . append ( 'path' ) ;
27872787 plotinfo . ylines = mainplot . overlines . append ( 'path' ) ;
27882788 plotinfo . xaxislayer = mainplot . overaxes . append ( 'g' ) ;
@@ -2793,9 +2793,6 @@ function makeCartesianPlotFramwork(gd, subplots) {
27932793 subplots . forEach ( function ( subplot ) {
27942794 var plotinfo = fullLayout . _plots [ subplot ] ;
27952795
2796- plotinfo . plot
2797- . attr ( 'preserveAspectRatio' , 'none' )
2798- . style ( 'fill' , 'none' ) ;
27992796 plotinfo . xlines
28002797 . style ( 'fill' , 'none' )
28012798 . classed ( 'crisp' , true ) ;
@@ -2844,9 +2841,28 @@ function lsInner(gd) {
28442841 xa . _length + 2 * gs . p , ya . _length + 2 * gs . p )
28452842 . call ( Color . fill , fullLayout . plot_bgcolor ) ;
28462843 }
2847- plotinfo . plot
2848- . call ( Drawing . setRect ,
2849- xa . _offset , ya . _offset , xa . _length , ya . _length ) ;
2844+
2845+ // Clip so that data only shows up on the plot area.
2846+ var clips = fullLayout . _defs . selectAll ( 'g.clips' ) ,
2847+ clipId = 'clip' + fullLayout . _uid + subplot + 'plot' ;
2848+
2849+ clips . selectAll ( '#' + clipId )
2850+ . data ( [ 0 ] )
2851+ . enter ( ) . append ( 'clipPath' )
2852+ . attr ( {
2853+ 'class' : 'plotclip' ,
2854+ 'id' : clipId
2855+ } )
2856+ . append ( 'rect' )
2857+ . attr ( {
2858+ 'width' : xa . _length ,
2859+ 'height' : ya . _length
2860+ } ) ;
2861+
2862+ plotinfo . plot . attr ( {
2863+ 'transform' : 'translate(' + xa . _offset + ', ' + ya . _offset + ')' ,
2864+ 'clip-path' : 'url(#' + clipId + ')'
2865+ } ) ;
28502866
28512867 var xlw = Drawing . crispRound ( gd , xa . linewidth , 1 ) ,
28522868 ylw = Drawing . crispRound ( gd , ya . linewidth , 1 ) ,
0 commit comments