Skip to content

Commit 938b9ff

Browse files
committed
fix arrayOk hoverinfo support for finance traces
1 parent caf887c commit 938b9ff

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: src/traces/ohlc/hover.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ function hoverSplit(pointData, xval, yval, hovermode) {
101101
// skip the rest (for this trace) if we didn't find a close point
102102
if(!closestPoint) return [];
103103

104-
var hoverinfo = trace.hoverinfo;
104+
var cdIndex = closestPoint.index;
105+
var di = cd[cdIndex];
106+
var hoverinfo = di.hi || trace.hoverinfo;
105107
var hoverParts = hoverinfo.split('+');
106108
var isAll = hoverinfo === 'all';
107109
var hasY = isAll || hoverParts.indexOf('y') !== -1;
@@ -166,7 +168,7 @@ function hoverOnPoints(pointData, xval, yval, hovermode) {
166168
return t.labels[attr] + Axes.hoverLabelText(ya, trace[attr][i]);
167169
}
168170

169-
var hoverinfo = trace.hoverinfo;
171+
var hoverinfo = di.hi || trace.hoverinfo;
170172
var hoverParts = hoverinfo.split('+');
171173
var isAll = hoverinfo === 'all';
172174
var hasY = isAll || hoverParts.indexOf('y') !== -1;

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

+7
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,13 @@ describe('finance trace hover:', function() {
11401140
exp: {
11411141
extraText: 'A'
11421142
}
1143+
}, {
1144+
type: type,
1145+
desc: 'just array text with array hoverinfo',
1146+
traces: [{hoverinfo: ['text', 'text'], text: ['A', 'B']}],
1147+
exp: {
1148+
extraText: 'A'
1149+
}
11431150
}]
11441151
.forEach(function(specs) {
11451152
it('should generate correct hover labels ' + type + ' - ' + specs.desc, function(done) {

0 commit comments

Comments
 (0)