Skip to content

Commit ed9ad69

Browse files
authored
Merge pull request #3282 from plotly/fix-segment-marker-less-fills
Fix fills on segment-less marker-less traces
2 parents 8ef1445 + b1478f4 commit ed9ad69

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/components/drawing/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ drawing.fillGroupStyle = function(s) {
198198
s.style('stroke-width', 0)
199199
.each(function(d) {
200200
var shape = d3.select(this);
201-
shape.call(Color.fill, d[0].trace.fillcolor);
201+
// N.B. 'd' won't be a calcdata item when
202+
// fill !== 'none' on a segment-less and marker-less trace
203+
if(d[0].trace) {
204+
shape.call(Color.fill, d[0].trace.fillcolor);
205+
}
202206
});
203207
};
204208

test/jasmine/tests/scatter_test.js

+14
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,20 @@ describe('end-to-end scatter tests', function() {
11041104
.catch(failTest)
11051105
.then(done);
11061106
});
1107+
1108+
it('should not error out when segment-less marker-less fill traces', function(done) {
1109+
Plotly.plot(gd, [{
1110+
x: [1, 2, 3, 4],
1111+
y: [null, null, null, null],
1112+
fill: 'tonexty'
1113+
}])
1114+
.then(function() {
1115+
expect(d3.selectAll('.js-fill').size()).toBe(1, 'js-fill is there');
1116+
expect(d3.select('.js-fill').attr('d')).toBe('M0,0Z', 'js-fill has an empty path');
1117+
})
1118+
.catch(failTest)
1119+
.then(done);
1120+
});
11071121
});
11081122

11091123
describe('stacked area', function() {

0 commit comments

Comments
 (0)