-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix relayout constrained axes + various multi-subplot perf improvements #2628
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a12a22b
fix "axrange" edit under axis constraint
etpinard 23964ca
rm doAutoRangeAndConstraints step from "axrange" edits
etpinard abd4bcf
move axis range/autorange/domain regex to module scope
etpinard 09d5dd0
skip Axes.makeClipPaths under hasOnlyLargeSploms regime
etpinard 5557d7b
resolves #2547 - target altered axes only on "axrange" edits
etpinard 73b354b
only grab 2d axes in lsInner
etpinard e69b7dd
mv find-main-subplot logic from supplyDefaults -> lsInner
etpinard c947b2c
only override grid.(x|y)side default for sploms w/o lower half
etpinard 6fa8ffd
update splom baselines
etpinard 455ff4d
update splom_ragged-via-axes baseline
etpinard 72b6558
split doTicks into multi-axes and doTicksSingle parts
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ exports.lsInner = function(gd) { | |
var fullLayout = gd._fullLayout; | ||
var gs = fullLayout._size; | ||
var pad = gs.p; | ||
var axList = Axes.list(gd); | ||
var axList = Axes.list(gd, '', true); | ||
|
||
// _has('cartesian') means SVG specifically, not GL2D - but GL2D | ||
// can still get here because it makes some of the SVG structure | ||
|
@@ -95,6 +95,11 @@ exports.lsInner = function(gd) { | |
ax._mainMirrorPosition = (ax.mirror && counterAx) ? | ||
getLinePosition(ax, counterAx, | ||
alignmentConstants.OPPOSITE_SIDE[ax.side]) : null; | ||
|
||
// Figure out which subplot to draw ticks, labels, & axis lines on | ||
// do this as a separate loop so we already have all the | ||
// _mainAxis and _anchorAxis links set | ||
ax._mainSubplot = findMainSubplot(ax, fullLayout); | ||
} | ||
|
||
fullLayout._paperdiv | ||
|
@@ -324,6 +329,48 @@ exports.lsInner = function(gd) { | |
return gd._promises.length && Promise.all(gd._promises); | ||
}; | ||
|
||
function findMainSubplot(ax, fullLayout) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexcjohnson I didn't bother making the "find main subplot" algo faster as you proposed in #2549 (comment), I was happy enough with skipping this whole thing except for sploms with |
||
var subplotList = fullLayout._subplots; | ||
var ids = subplotList.cartesian.concat(subplotList.gl2d || []); | ||
var mockGd = {_fullLayout: fullLayout}; | ||
|
||
var isX = ax._id.charAt(0) === 'x'; | ||
var anchorAx = ax._mainAxis._anchorAxis; | ||
var mainSubplotID = ''; | ||
var nextBestMainSubplotID = ''; | ||
var anchorID = ''; | ||
|
||
// First try the main ID with the anchor | ||
if(anchorAx) { | ||
anchorID = anchorAx._mainAxis._id; | ||
mainSubplotID = isX ? (ax._id + anchorID) : (anchorID + ax._id); | ||
} | ||
|
||
// Then look for a subplot with the counteraxis overlaying the anchor | ||
// If that fails just use the first subplot including this axis | ||
if(!mainSubplotID || !fullLayout._plots[mainSubplotID]) { | ||
mainSubplotID = ''; | ||
|
||
for(var j = 0; j < ids.length; j++) { | ||
var id = ids[j]; | ||
var yIndex = id.indexOf('y'); | ||
var idPart = isX ? id.substr(0, yIndex) : id.substr(yIndex); | ||
var counterPart = isX ? id.substr(yIndex) : id.substr(0, yIndex); | ||
|
||
if(idPart === ax._id) { | ||
if(!nextBestMainSubplotID) nextBestMainSubplotID = id; | ||
var counterAx = Axes.getFromId(mockGd, counterPart); | ||
if(anchorID && counterAx.overlaying === anchorID) { | ||
mainSubplotID = id; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
return mainSubplotID || nextBestMainSubplotID; | ||
} | ||
|
||
function shouldShowLinesOrTicks(ax, subplot) { | ||
return (ax.ticks || ax.showline) && | ||
(subplot === ax._mainSubplot || ax.mirror === 'all' || ax.mirror === 'allticks'); | ||
|
@@ -448,8 +495,12 @@ exports.doLegend = function(gd) { | |
return Plots.previousPromises(gd); | ||
}; | ||
|
||
exports.doTicksRelayout = function(gd) { | ||
Axes.doTicks(gd, 'redraw'); | ||
exports.doTicksRelayout = function(gd, rangesAltered) { | ||
if(rangesAltered) { | ||
Axes.doTicks(gd, Object.keys(rangesAltered), true); | ||
} else { | ||
Axes.doTicks(gd, 'redraw'); | ||
} | ||
|
||
if(gd._fullLayout._hasOnlyLargeSploms) { | ||
clearGlCanvases(gd); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, nice catch!