Skip to content

Commit b6d9930

Browse files
committed
Switch subplot svg -> g
1 parent c53a00a commit b6d9930

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

src/plot_api/plot_api.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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),

src/plots/cartesian/axes.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,7 @@ axes.doTicks = function(gd, axid, skipTitle) {
13211321
var plotinfo = fullLayout._plots[subplot],
13221322
xa = plotinfo.x(),
13231323
ya = plotinfo.y();
1324-
plotinfo.plot.attr('viewBox',
1325-
'0 0 '+xa._length + ' ' + ya._length);
1324+
13261325
plotinfo.xaxislayer
13271326
.selectAll('.' + xa._id + 'tick').remove();
13281327
plotinfo.yaxislayer

0 commit comments

Comments
 (0)