Skip to content

Commit 1b607c3

Browse files
authored
Merge pull request #3644 from plotly/fix3630-errorbars-disappear-after-double-click
Bug fix errorbars on bar trace may disappear after switch modebar to select and double click
2 parents 93f2a53 + 5a5702f commit 1b607c3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Diff for: src/traces/bar/style.js

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ function styleOnSelect(gd, cd) {
7070
stylePointsInSelectionMode(s, trace, gd);
7171
} else {
7272
stylePoints(s, trace, gd);
73+
74+
Registry.getComponentMethod('errorbars', 'style')(s);
7375
}
7476
}
7577

Diff for: test/jasmine/tests/select_test.js

+39
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,45 @@ describe('Click-to-select', function() {
691691
}
692692
});
693693

694+
it('should maintain style of errorbars after double click cleared selection (bar case)', function(done) {
695+
Plotly.newPlot(gd, { // Note: this call should be newPlot not plot
696+
data: [{
697+
x: [0, 1, 2],
698+
y: [100, 200, 400],
699+
type: 'bar',
700+
marker: {
701+
color: 'yellow'
702+
},
703+
error_y: {
704+
type: 'sqrt'
705+
}
706+
}],
707+
layout: {
708+
dragmode: 'select'
709+
}
710+
})
711+
.then(function() {
712+
var x = 100;
713+
var y = 100;
714+
drag([[x, y], [x, y]]); // first empty drag
715+
return doubleClick(x, y); // then double click
716+
})
717+
.then(function() {
718+
assertSelectionCleared();
719+
})
720+
.then(function() {
721+
d3.select(gd).select('g.plot').each(function() {
722+
d3.select(this).selectAll('g.errorbar').selectAll('path').each(function() {
723+
expect(d3.select(this).attr('style'))
724+
.toBe('vector-effect: non-scaling-stroke; stroke-width: 2px; stroke: rgb(68, 68, 68); stroke-opacity: 1; opacity: 1; fill: rgb(255, 255, 0); fill-opacity: 1;', 'to be visible'
725+
);
726+
});
727+
});
728+
})
729+
.catch(failTest)
730+
.then(done);
731+
});
732+
694733
describe('triggers \'plotly_selected\' before \'plotly_click\'', function() {
695734
[
696735
testCase('cartesian', require('@mocks/14.json'), 270, 160, [7]),

0 commit comments

Comments
 (0)