Skip to content

Commit

Permalink
doc: expand comment about placeholder calc point
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Oct 5, 2016
1 parent 7498fe6 commit 510cb60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1670,9 +1670,12 @@ plots.doCalcdata = function(gd, traces) {
}

// Make sure there is a first point.
//
// This ensures there is a calcdata item for every trace,
// even if cartesian logic doesn't handle it (for things like legends).
// Tag this artificial calc point with 'placeholder: true'
//
// Tag this artificial calc point with 'placeholder: true',
// to make it easier to skip over them in during the plot and hover step.
if(!Array.isArray(cd) || !cd[0]) {
cd = [{x: false, y: false, placeholder: true}];
}
Expand Down
3 changes: 3 additions & 0 deletions src/traces/scattergeo/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ module.exports = function hoverPoints(pointData) {
dy = Math.abs(yPx - pos[1]),
rad = Math.max(3, d.mrc || 0);

// N.B. d.mrc is the calculated marker radius
// which is only set for trace with 'markers' mode.

return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - 3 / rad);
}

Expand Down

0 comments on commit 510cb60

Please sign in to comment.