Skip to content

Commit 74bd9b2

Browse files
committed
fix #3038 - fill 'text' during barpolar hover
1 parent e672fb9 commit 74bd9b2

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/traces/barpolar/hover.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
var Fx = require('../../components/fx');
1212
var Lib = require('../../lib');
1313
var getTraceColor = require('../bar/hover').getTraceColor;
14+
var fillHoverText = require('../scatter/fill_hover_text');
1415
var makeHoverPointText = require('../scatterpolar/hover').makeHoverPointText;
1516
var isPtInsidePolygon = require('../../plots/polar/helpers').isPtInsidePolygon;
1617

@@ -58,7 +59,8 @@ module.exports = function hoverPoints(pointData, xval, yval) {
5859
pointData.y0 = pointData.y1 = cdi.ct[1];
5960

6061
var _cdi = Lib.extendFlat({}, cdi, {r: cdi.s, theta: cdi.p});
61-
pointData.extraText = makeHoverPointText(_cdi, trace, subplot);
62+
fillHoverText(cdi, trace, pointData);
63+
makeHoverPointText(_cdi, trace, subplot, pointData);
6264
pointData.color = getTraceColor(trace, cdi);
6365
pointData.xLabelVal = pointData.yLabelVal = undefined;
6466

test/jasmine/tests/barpolar_test.js

+32
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,38 @@ describe('Test barpolar hover:', function() {
115115
extraText: 'r: 1<br>θ: 0°',
116116
color: '#1f77b4'
117117
}
118+
}, {
119+
desc: 'with custom text scalar',
120+
traces: [{
121+
r: [1, 2, 3],
122+
theta: [0, 90, 180],
123+
text: 'TEXT'
124+
}],
125+
xval: 1,
126+
yval: 0,
127+
exp: {
128+
index: 0,
129+
x: 263.33,
130+
y: 200,
131+
extraText: 'r: 1<br>θ: 0°<br>TEXT',
132+
color: '#1f77b4'
133+
}
134+
}, {
135+
desc: 'with custom text array',
136+
traces: [{
137+
r: [1, 2, 3],
138+
theta: [0, 90, 180],
139+
text: ['A', 'B', 'C']
140+
}],
141+
xval: 1,
142+
yval: 0,
143+
exp: {
144+
index: 0,
145+
x: 263.33,
146+
y: 200,
147+
extraText: 'r: 1<br>θ: 0°<br>A',
148+
color: '#1f77b4'
149+
}
118150
}, {
119151
desc: 'works with bars with offsets',
120152
traces: [{

0 commit comments

Comments
 (0)