Skip to content

Commit 460ac39

Browse files
authored
Merge pull request #1626 from plotly/add-class-to-text-trace
Add textpoint class to scatter text points
2 parents 33196da + 43611d2 commit 460ac39

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/traces/scatter/plot.js

+1
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
460460
});
461461

462462
join.selectAll('text')
463+
.classed('textpoint', true)
463464
.call(Drawing.textPointStyle, trace)
464465
.each(function(d) {
465466

test/jasmine/tests/scatter_test.js

+11
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,17 @@ describe('end-to-end scatter tests', function() {
372372

373373
}).catch(fail).then(done);
374374
});
375+
376+
it('adds "textpoint" class to scatter text points', function(done) {
377+
Plotly.plot(gd, [{
378+
mode: 'text',
379+
x: [1, 2, 3],
380+
y: [2, 3, 4],
381+
text: ['a', 'b', 'c']
382+
}]).then(function() {
383+
expect(Plotly.d3.selectAll('.textpoint').size()).toBe(3);
384+
}).catch(fail).then(done);
385+
});
375386
});
376387

377388
describe('scatter hoverPoints', function() {

0 commit comments

Comments
 (0)