diff --git a/src/traces/bar/plot.js b/src/traces/bar/plot.js index d9ee36c2265..ff69c21f01f 100644 --- a/src/traces/bar/plot.js +++ b/src/traces/bar/plot.js @@ -37,8 +37,9 @@ module.exports = function plot(gd, plotinfo, cdbar) { var bartraces = plotinfo.plot.select('.barlayer') .selectAll('g.trace.bars') - .data(cdbar) - .enter().append('g') + .data(cdbar); + + bartraces.enter().append('g') .attr('class', 'trace bars'); bartraces.append('g') diff --git a/test/image/baselines/bar_and_histogram.png b/test/image/baselines/bar_and_histogram.png new file mode 100644 index 00000000000..d5e426b968f Binary files /dev/null and b/test/image/baselines/bar_and_histogram.png differ diff --git a/test/image/mocks/bar_and_histogram.json b/test/image/mocks/bar_and_histogram.json new file mode 100644 index 00000000000..c14416c6785 --- /dev/null +++ b/test/image/mocks/bar_and_histogram.json @@ -0,0 +1,13 @@ +{ + "data": [ + { "x": [1,1,1,1,1,2,2,2,3,3], "type": "histogram" }, + { "x": [1,2,3], "y":[-1,-2,-3], "type": "bar" }, + { "x": [1,2,3], "y":[-1,-2,-3], "type": "bar", "yaxis":"y2" }, + { "x": [1,1,1,1,1,2,2,2,3,3], "type": "histogram", "yaxis":"y2" } + ], + "layout": { + "yaxis": { "domain": [0,0.49] }, + "yaxis2": { "domain": [0.51, 1] }, + "showlegend": false + } +}