8000 Axes.draw w/o getBoundingClientRect + many axis automargin fixes by etpinard · Pull Request #4165 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Axes.draw w/o getBoundingClientRect + many axis automargin fixes #4165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use Axes.getPxPosition instead of ax._boundingBox
... to position cartesian spike edges. This allows us to not
    have to compute the axis bounding box to render the spikes.
  • Loading branch information
etpinard committed Sep 4, 2019
commit 2e7b3dd6143ac9fddbc200dcc883f08c96c4a175
13 changes: 6 additions & 7 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
var result = dragElement.unhoverRaw(gd, evt);
if(hasCartesian && ((spikePoints.hLinePoint !== null) || (spikePoints.vLinePoint !== null))) {
if(spikesChanged(oldspikepoints)) {
createSpikelines(spikePoints, spikelineOpts);
createSpikelines(gd, spikePoints, spikelineOpts);
}
}
return result;
}

if(hasCartesian) {
if(spikesChanged(oldspikepoints)) {
createSpikelines(spikePoints, spikelineOpts);
createSpikelines(gd, spikePoints, spikelineOpts);
}
}

Expand Down Expand Up @@ -1396,9 +1396,10 @@ function cleanPoint(d, hovermode) {
return d;
}

function createSpikelines(closestPoints, opts) {
function createSpikelines(gd, closestPoints, opts) {
var container = opts.container;
var fullLayout = opts.fullLayout;
var gs = fullLayout._size;
var evt = opts.event;
var showY = !!closestPoints.hLinePoint;
var showX = !!closestPoints.vLinePoint;
Expand Down Expand Up @@ -1433,8 +1434,7 @@ function createSpikelines(closestPoints, opts) {
var yMode = ya.spikemode;
var yThickness = ya.spikethickness;
var yColor = ya.spikecolor || dfltHLineColor;
var yBB = ya._boundingBox;
var xEdge = ((yBB.left + yBB.right) / 2) < hLinePointX ? yBB.right : yBB.left;
var xEdge = Axes.getPxPosition(gd, ya);
var xBase, xEndSpike;

if(yMode.indexOf('toaxis') !== -1 || yMode.indexOf('across') !== -1) {
Expand Down Expand Up @@ -1507,8 +1507,7 @@ function createSpikelines(closestPoints, opts) {
var xMode = xa.spikemode;
var xThickness = xa.spikethickness;
var xColor = xa.spikecolor || dfltVLineColor;
var xBB = xa._boundingBox;
var yEdge = ((xBB.top + xBB.bottom) / 2) < vLinePointY ? xBB.bottom : xBB.top;
var yEdge = Axes.getPxPosition(gd, xa);
var yBase, yEndSpike;

if(xMode.indexOf('toaxis') !== -1 || xMode.indexOf('across') !== -1) {
Expand Down
0