Skip to content

Commit 2e05455

Browse files
committed
do not delete hoverlabel when hovertemplate is defined
1 parent 58bf5bb commit 2e05455

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/fx/hover.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,9 @@ function createHoverText(hoverData, opts, gd) {
957957
if(d.extraText !== undefined) text += (text ? '<br>' : '') + d.extraText;
958958

959959
// if 'text' is empty at this point,
960+
// and hovertemplate is not defined,
960961
// put 'name' in main label and don't show secondary label
961-
if(text === '') {
962+
if(text === '' && !d.hovertemplate) {
962963
// if 'name' is also empty, remove entire label
963964
if(name === '') g.remove();
964965
text = name;

test/jasmine/tests/pie_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ describe('pie hovering', function() {
10841084
});
10851085

10861086
it('should use hovertemplate if specified', function(done) {
1087+
mockCopy.data[0].name = '';
10871088
Plotly.plot(gd, mockCopy.data, mockCopy.layout)
10881089
.then(_hover)
10891090
.then(function() {

0 commit comments

Comments
 (0)