Skip to content

Commit fd867c3

Browse files
committed
revise attribute def
1 parent ed06517 commit fd867c3

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

Diff for: src/components/fx/hover.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
270270
var hovermodeHasX = (hovermode || '').charAt(0) === 'x';
271271
var hovermodeHasY = (hovermode || '').charAt(0) === 'y';
272272

273-
if(hoverthrough && hasCartesian && (hovermodeHasX || hovermodeHasY)) {
273+
if(hasCartesian && (hovermodeHasX || hovermodeHasY) && hoverthrough === 'axis') {
274274
var subplotsLength = subplots.length;
275275
for(var p = 0; p < subplotsLength; p++) {
276276
spId = subplots[p];

Diff for: src/components/fx/layout_attributes.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ module.exports = {
7979
].join(' ')
8080
},
8181
hoverthrough: {
82-
valType: 'boolean',
82+
valType: 'enumerated',
83+
values: ['axis', false],
8384
dflt: false,
8485
editType: 'none',
8586
description: [
86-
'Determines expansion of hover effects to other subplots in case of sharing an axis.',
87+
'Determines expansion of hover effects to other subplots',
88+
'If *axis*, points from subplots linked to the axis of hovered subplot are included.',
8789
'Has an effect only when `hovermode` is set to *x*, *x unified*, *y* or *y unified*.',
8890
].join(' ')
8991
},

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function hoverPoints(pointData, xval, yval, hovermode, opts) {
1616

1717
var points = _hoverPoints(pointData, xpx, ypx);
1818

19-
if(opts.hoverthrough && (hovermodeHasX || hovermodeHasY)) {
19+
if((hovermodeHasX || hovermodeHasY) && opts.hoverthrough === 'axis') {
2020
var _xpx = points[0]._xpx;
2121
var _ypx = points[0]._ypx;
2222

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -2380,12 +2380,12 @@ describe('hover info on stacked subplots', function() {
23802380
});
23812381
});
23822382

2383-
describe('hover on subplots when hoverthrough is set to true and x hovermodes', function() {
2383+
describe('hover on subplots when hoverthrough is set to *axis* and x hovermodes', function() {
23842384
'use strict';
23852385

23862386
var mock = {
23872387
layout: {
2388-
hoverthrough: true,
2388+
hoverthrough: 'axis',
23892389
hovermode: 'x',
23902390
grid: {
23912391
rows: 3,
@@ -2423,7 +2423,7 @@ describe('hover on subplots when hoverthrough is set to true and x hovermodes',
24232423

24242424
afterEach(destroyGraphDiv);
24252425

2426-
it('hovermode: *x* | *x unified* with hoverthrough: true', function() {
2426+
it('hovermode: *x* | *x unified* with hoverthrough: *axis*', function() {
24272427
var pos = 0;
24282428
var subplot = 'xy';
24292429
Lib.clearThrottle();
@@ -2468,12 +2468,12 @@ describe('hover on subplots when hoverthrough is set to true and x hovermodes',
24682468
});
24692469
});
24702470

2471-
describe('hover on subplots when hoverthrough is set to true and y hovermodes', function() {
2471+
describe('hover on subplots when hoverthrough is set to *axis* and y hovermodes', function() {
24722472
'use strict';
24732473

24742474
var mock = {
24752475
layout: {
2476-
hoverthrough: true,
2476+
hoverthrough: 'axis',
24772477
hovermode: 'y',
24782478
grid: {
24792479
rows: 2,
@@ -2511,7 +2511,7 @@ describe('hover on subplots when hoverthrough is set to true and y hovermodes',
25112511

25122512
afterEach(destroyGraphDiv);
25132513

2514-
it('hovermode: *y* | *y unified* with hoverthrough: true', function() {
2514+
it('hovermode: *y* | *y unified* with hoverthrough: *axis*', function() {
25152515
var pos = 0;
25162516
var subplot = 'xy';
25172517
Lib.clearThrottle();
@@ -2556,12 +2556,12 @@ describe('hover on subplots when hoverthrough is set to true and y hovermodes',
25562556
});
25572557
});
25582558

2559-
describe('splom hover on subplots when hoverthrough is set to true and (x|y) hovermodes', function() {
2559+
describe('splom hover on subplots when hoverthrough is set to *axis* and (x|y) hovermodes', function() {
25602560
'use strict';
25612561

25622562
var mock = Lib.extendDeep({}, splomLogMock);
25632563
mock.layout.hovermode = 'x';
2564-
mock.layout.hoverthrough = true;
2564+
mock.layout.hoverthrough = 'axis';
25652565

25662566
var gd;
25672567

@@ -2572,7 +2572,7 @@ describe('splom hover on subplots when hoverthrough is set to true and (x|y) hov
25722572

25732573
afterEach(destroyGraphDiv);
25742574

2575-
it('splom hoverthrough: true', function() {
2575+
it('splom hoverthrough: *axis*', function() {
25762576
Lib.clearThrottle();
25772577
Plotly.Fx.hover(gd, {x: 200, y: 200}, 'xy');
25782578
expect(gd._hoverdata.length).toBe(3);

Diff for: test/plot-schema.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -2635,10 +2635,14 @@
26352635
]
26362636
},
26372637
"hoverthrough": {
2638-
"description": "Determines expansion of hover effects to other subplots in case of sharing an axis. Has an effect only when `hovermode` is set to *x*, *x unified*, *y* or *y unified*.",
2638+
"description": "Determines expansion of hover effects to other subplots If *axis*, points from subplots linked to the axis of hovered subplot are included. Has an effect only when `hovermode` is set to *x*, *x unified*, *y* or *y unified*.",
26392639
"dflt": false,
26402640
"editType": "none",
2641-
"valType": "boolean"
2641+
"valType": "enumerated",
2642+
"values": [
2643+
"axis",
2644+
false
2645+
]
26422646
},
26432647
"images": {
26442648
"items": {

0 commit comments

Comments
 (0)