Skip to content

Commit c40dd6b

Browse files
committed
add support for 'text' (scalar value only)
1 parent 94f6195 commit c40dd6b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/traces/streamtube/attributes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ var attrs = {
8989
description: ''
9090
},
9191

92-
// TODO maybe just remove completely?
9392
text: {
9493
valType: 'string',
9594
role: 'info',
9695
dflt: '',
9796
editType: 'calc',
9897
description: [
99-
'Sets the text elements associated with the cones.',
100-
'If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,',
101-
'these elements will be seen in the hover labels.'
98+
'Sets a text element associated with this trace.',
99+
'If trace `hoverinfo` contains a *text* flag,',
100+
'this text element will be seen in all hover labels.',
101+
'Note that streamtube traces do not support array `text` values.'
102102
].join(' ')
103103
}
104104
};

src/traces/streamtube/convert.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ proto.handlePick = function(selection) {
5555
selection.data.divergence
5656
];
5757

58+
selection.textLabel = this.data.text;
59+
5860
return true;
5961
}
6062
};

test/jasmine/tests/streamtube_test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,15 @@ describe('@gl Test streamtube hover', function() {
274274
.then(_hover)
275275
.then(function() {
276276
assertHoverLabelContent({nums: 'divergence: 0.465'});
277+
return Plotly.restyle(gd, {
278+
hoverinfo: 'text',
279+
text: '!SCALAR TX!'
280+
});
281+
})
282+
.then(delay(20))
283+
.then(_hover)
284+
.then(function() {
285+
assertHoverLabelContent({nums: '!SCALAR TX!'});
277286
})
278287
.catch(failTest)
279288
.then(done);

0 commit comments

Comments
 (0)