(gd, evt, subplot, noHoverEvent, eventTarget)
| 265 | |
| 266 | // The actual implementation is here: |
| 267 | function _hover(gd, evt, subplot, noHoverEvent, eventTarget) { |
| 268 | if (!subplot) subplot = 'xy'; |
| 269 | |
| 270 | if (typeof subplot === 'string') { |
| 271 | // drop zindex from subplot id |
| 272 | subplot = subplot.split(zindexSeparator)[0]; |
| 273 | } |
| 274 | |
| 275 | // if the user passed in an array of subplots, |
| 276 | // use those instead of finding overlayed plots |
| 277 | var subplots = Array.isArray(subplot) ? subplot : [subplot]; |
| 278 | |
| 279 | var spId; |
| 280 | |
| 281 | var fullLayout = gd._fullLayout; |
| 282 | var hoversubplots = fullLayout.hoversubplots; |
| 283 | var plots = fullLayout._plots || []; |
| 284 | var plotinfo = plots[subplot]; |
| 285 | var hasCartesian = fullLayout._has('cartesian'); |
| 286 | |
| 287 | var hovermode = evt.hovermode || fullLayout.hovermode; |
| 288 | var hovermodeHasX = (hovermode || '').charAt(0) === 'x'; |
| 289 | var hovermodeHasY = (hovermode || '').charAt(0) === 'y'; |
| 290 | |
| 291 | var firstXaxis; |
| 292 | var firstYaxis; |
| 293 | |
| 294 | if (hasCartesian && (hovermodeHasX || hovermodeHasY) && hoversubplots === 'axis') { |
| 295 | var subplotsLength = subplots.length; |
| 296 | for (var p = 0; p < subplotsLength; p++) { |
| 297 | spId = subplots[p]; |
| 298 | if (plots[spId]) { |
| 299 | // 'cartesian' case |
| 300 | |
| 301 | firstXaxis = Axes.getFromId(gd, spId, 'x'); |
| 302 | firstYaxis = Axes.getFromId(gd, spId, 'y'); |
| 303 | |
| 304 | var subplotsWith = (hovermodeHasX ? firstXaxis : firstYaxis)._subplotsWith; |
| 305 | |
| 306 | if (subplotsWith && subplotsWith.length) { |
| 307 | for (var q = 0; q < subplotsWith.length; q++) { |
| 308 | pushUnique(subplots, subplotsWith[q]); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | // list of all overlaid subplots to look at |
| 316 | if (plotinfo && hoversubplots !== 'single') { |
| 317 | var overlayedSubplots = plotinfo.overlays.map(function (pi) { |
| 318 | return pi.id; |
| 319 | }); |
| 320 | |
| 321 | subplots = subplots.concat(overlayedSubplots); |
| 322 | } |
| 323 | |
| 324 | var len = subplots.length; |
no test coverage detected
searching dependent graphs…