@@ -2756,7 +2756,7 @@ function makeCartesianPlotFramwork(gd, subplots) {
2756
2756
plotinfo . overgrid = plotgroup . append ( 'g' ) ;
2757
2757
plotinfo . zerolinelayer = plotgroup . append ( 'g' ) ;
2758
2758
plotinfo . overzero = plotgroup . append ( 'g' ) ;
2759
- plotinfo . plot = plotgroup . append ( 'svg ' ) . call ( plotLayers ) ;
2759
+ plotinfo . plot = plotgroup . append ( 'g ' ) . call ( plotLayers ) ;
2760
2760
plotinfo . overplot = plotgroup . append ( 'g' ) ;
2761
2761
plotinfo . xlines = plotgroup . append ( 'path' ) ;
2762
2762
plotinfo . ylines = plotgroup . append ( 'path' ) ;
@@ -2782,7 +2782,7 @@ function makeCartesianPlotFramwork(gd, subplots) {
2782
2782
2783
2783
plotinfo . gridlayer = mainplot . overgrid . append ( 'g' ) ;
2784
2784
plotinfo . zerolinelayer = mainplot . overzero . append ( 'g' ) ;
2785
- plotinfo . plot = mainplot . overplot . append ( 'svg ' ) . call ( plotLayers ) ;
2785
+ plotinfo . plot = mainplot . overplot . append ( 'g ' ) . call ( plotLayers ) ;
2786
2786
plotinfo . xlines = mainplot . overlines . append ( 'path' ) ;
2787
2787
plotinfo . ylines = mainplot . overlines . append ( 'path' ) ;
2788
2788
plotinfo . xaxislayer = mainplot . overaxes . append ( 'g' ) ;
@@ -2793,9 +2793,6 @@ function makeCartesianPlotFramwork(gd, subplots) {
2793
2793
subplots . forEach ( function ( subplot ) {
2794
2794
var plotinfo = fullLayout . _plots [ subplot ] ;
2795
2795
2796
- plotinfo . plot
2797
- . attr ( 'preserveAspectRatio' , 'none' )
2798
- . style ( 'fill' , 'none' ) ;
2799
2796
plotinfo . xlines
2800
2797
. style ( 'fill' , 'none' )
2801
2798
. classed ( 'crisp' , true ) ;
@@ -2844,9 +2841,28 @@ function lsInner(gd) {
2844
2841
xa . _length + 2 * gs . p , ya . _length + 2 * gs . p )
2845
2842
. call ( Color . fill , fullLayout . plot_bgcolor ) ;
2846
2843
}
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
+ } ) ;
2850
2866
2851
2867
var xlw = Drawing . crispRound ( gd , xa . linewidth , 1 ) ,
2852
2868
ylw = Drawing . crispRound ( gd , ya . linewidth , 1 ) ,
0 commit comments