Skip to content

Commit 320485f

Browse files
committed
add hovertext support
1 parent e82a826 commit 320485f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/traces/volume/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ proto.handlePick = function(selection) {
5454
this.data.value[selectIndex]
5555
];
5656

57-
var text = this.data.text;
57+
var text = this.data.hovertext || this.data.text;
5858
if(Array.isArray(text) && text[selectIndex] !== undefined) {
5959
selection.textLabel = text[selectIndex];
6060
} else if(text) {

test/jasmine/tests/volume_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,27 @@ describe('Test volume', function() {
399399
].join('\n')
400400
});
401401
})
402+
.then(function() {
403+
return Plotly.restyle(gd, 'hovertext', [
404+
fig.data[0].value.map(function(v) { return '!! ' + v + ' !!'; })
405+
]);
406+
})
407+
.then(delay(20))
408+
.then(_hover4)
409+
.then(function() {
410+
assertHoverLabelContent({
411+
nums: [
412+
'x: 0.4',
413+
'y: 0.001',
414+
'z: −2',
415+
'value: −1.26',
416+
'!! -1.26 !!'
417+
].join('\n')
418+
});
419+
})
420+
.then(function() {
421+
return Plotly.restyle(gd, 'hovertemplate', '%{value}<br>(%{x},%{y},%{z})<extra>!!</extra>');
422+
})
402423
.catch(failTest)
403424
.then(done);
404425
});

0 commit comments

Comments
 (0)